When I open a solution containing an MVC3 project in Visual Studio 11 Beta, I see the following message:
The Web project 'Landboss.Web' requires missing web components to run with Visual Studio. Would you like to download and install them using the Web Platform Installer now? (Note: Some components might require restart to take effect.)
ASP.NET Web pages with Razor syntax 1.0.0.0
When I click Yes, the Web Platform Installer opens and tells me this:
So far I've installed Visual Studio 11 Beta on two machines and both have this same problem.
I got this error when something in the web.config file was corrupted. I simply formatted the file and then resaved it. Then I restarted Visual Studio.
This is related to the configuration setting webpages:Version
if you have multiple versions of razor on the system (1 or 2 for now), better add this setting if it's missing. Choose the version you want/need at the appropriate level. (Obviously replace the brackets...)
I believe this was caused by the fact that I had previously installed Visual Studio 11 Developer Preview. I did uninstall it before installing the Beta, but you know how that goes.
To fix it, I did the following:
It worked! Razor syntax highlighting and intellisense are back, and the warning message no longer shows when I open the project.
I have also had this error happen when a Subversion conflict was committed to the repository - the presence of this block in the web.config's app settings seemed to trigger the message when loading the project:
Cleaning up the Subversion conflict in appSettings resolved this error.
I've just been bitten by this and it's another variation of the
web.config
problem. In my case we do not store a web.config file in our repo but generate one from a template as a custom build step. When we do a clean of the workspace* this file was being deleted (rightly so because it's not in the repo) and so the next time Visual Studio was started it complained. A command line build via msbuild was never affected by this.*We have a "partial" clean, which deletes all the build artefacts (including those VS leaves behind) and a "full" clean that resets the workspace to the same state as if you had just pulled it from the repo.
While @silent__thought's solution may correct the problem, it's not the easiest way to fix it.
@Costas solution may exactly address the problem, but here is a more detailed explanation if you need it.
In my case, I needed the following in my web.config file (for MVC 4):
Of course, you may not need all of these configurations for your app. These just happen to be the default settings for an MVC 4 project.