IIS Express Error: "Could not determine which version of ASP.NET Web Pages to use"

Have you updated to the latest Visual Studio yet? I upgraded to the release version of Visual Studio 2012, which I hope many of you have had the opportunity to do or will in the near future. I do a lot of development with WebMatrix and utilize IIS Express as a local web server. After completing the Visual Studio 2012 upgrade I opened a web site in WebMatrix I have been developing lately and noticed there was an error indicated at the bottom of the IDE.

To the right you will see a link to copy the error to the clipboard. If you launch the web site you will get a yellow screen of death with the same information. The error says "Could not determine which version of ASP.NET Web Pages to use". It goes on to say you need to modify the site's web.config file to specify the version and a link to a resource on the ASP.NET web site about running different versions of ASP.NET Web Pages side by side.

The resource on ASP.NET explains how to explicitly specify the version of webPages to use. You need to add a webPages:Version key to the appSettings config section. For my purposes I am running version 2.0, which is the latest version. The appSettings section belongs to the Configuration element in the web.config file.

 

<

appSettings

>


<

add

key

="webPages:Version"

value

="2.0"

/>


</

appSettings

>



After adding this section to my WebMatrix site's web.config file I was able to run my site again. Somehow I feel that reinstalling WebMatrix might fix the issue, but for now this is a workable solution for my purposes and I hope it helps you out as well.

Share This Article With Your Friends!