On several occasions while working with aspx/ascx files in Visual Studio I’ve run into an issue where the IDE stopped generating and updating designer files. I would get the following warning message when I compiled:
Generation of designer file failed: Value cannot be null.
Parameter name: virtualPath
Googling the warning message gets a lot of hits related to “Generation of designer file failed” but I was unable to find anything about a virtualPath parameter. I finally found the solution today while setting some values under the “Web” tab on the properties page for my VS project. Under the “Servers” section there’s a text box with the label “Virtual Path”, and for my project it was blank! I set the value in the text box to “/” and the IDE started happily generating and updating designer files again.
I assumed that an error in this setting would have caused a problem with running the project using Visual Studio’s built in development server, but it didn’t. Silly me.