You may get this error if you have an MVC 2 project that at one point was an MVC 3 project.
This happened to me when I had to revert back to an MVC 2 version of an MVC 3 project. I had shelved my MVC 3.0 changes and brached the code in TFS (to make hotfixes to the MVC 2 version), but had leftover web.config files for my Razor Views. This was confusing the compiler.
- Search for web.config in your directory structure (in Windows explorer or Visual Studio's 'find in files'). Don't do 'Search in Solution' because you may have web.config files not present in the project. IIS will still load them even if they're not in your solution. Rename any web.config files containing
3.0.0.0
to _web.config and it will stop looking. Then restart IIS.
This should fix the problem.
If you still have the problem you may need to close all Visual Studio instances, stop IIS and delete temporary internet files. You can get the path to this directory by clicking the 'Show Detailed Compiler Output' link on the error page and searching for 'temporary'.