Possible Bug: ASP.NET MVC 5.1 - Intellisense Broken in VS2012

Topics: ASP.NET MVC, General
Jan 24, 2014 at 1:14 PM
Edited Jan 24, 2014 at 1:27 PM
Hi, I've just upgraded to an application to ASP.NET MVC 5.1. I used NuGet to do this. I also installed the update (note that i'm using Visual Studio 2012):

http://blogs.msdn.com/b/webdev/archive/2014/01/20/announcing-the-release-of-asp-net-mvc-5-1-asp-net-web-api-2-1-and-asp-net-web-pages-3-1.aspx

The application builds and runs fine, however when I tried to edit one of the views the intellisense and the following error is thrown:

"One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?"

I did a search for this error message and have been through the suggested solutions but now I've broken it even further and get the error message:

"ASP.NET runtime error: There is no build provider registered for the extension '.cshtml'. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'"

I've even tried creating a new application and using the same exact config files but I get the same error. I've now wasted a day on this and I wish I never bothered with the upgrade. Really appreciate the help/advice.

Thanks
Coordinator
Jan 27, 2014 at 7:44 PM
Could you please confirm that you have already installed ASP.NET and Web Tools 2013.1 for Visual Studio 2012?

From which version of MVC did you start from before the upgrade? If you started from MVC 4 you need to do these additional steps:

http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2

Daniel Roth
Jan 28, 2014 at 8:13 AM
Edited Jan 28, 2014 at 11:48 AM
Thanks for your reply, yes I can confirm I ran the update above. I had already upgraded the application to MVC 5 (using an earlier update) and had intellisense working fine. I then ran the latest 2013.1 update and updated my nuget packages to MVC 5.1 and then the intellisense issues started. Please note that I can replicate this problem using the following steps:
  1. Download and open the following application https://github.com/davidebbo-test/Mvc51ApplicationFx451.
  2. Do a build
  3. Now removing the entire contents of project apart from the Views directory and the packages.config file
  4. Open one of the views and you'll an error message.
This likely comes down to removing the root Web.config file but I use razor generator to package each application up into their own modules. This was working fine before the 5.1 update. I'd appreciate if you could let me know if you are getting the same problem or if this is just an issue my end.

Thanks