Visual Studio : virtualPath cannot be null

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.

Virtual Path setting under Servers section of Web properties in Visual Studio project properties file.
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.

This entry was posted in General. Bookmark the permalink.

Warning: count(): Parameter must be an array or an object that implements Countable in /homepages/5/d154205736/htdocs/wordpress/wp-includes/class-wp-comment-query.php on line 405

2 Responses to Visual Studio : virtualPath cannot be null

  1. That is interesting! But I am not going to be using Visual Studio in the near future so I might never have the error: “virtualPath cannot be null”.

  2. Dan says:

    Um, okay Ben.
    Thanks for the post, Rob!

Leave a Reply

Your email address will not be published. Required fields are marked *