I am currently working on a MVC3 project with Razor.
I have switchen on compilation of Views to be aware of spelling errors etc. at compile-time.
As soon as I switch on the <MvcBuildViews>true</MvcBuildViews> in the projects configuration file a get the following error during compile:
Error 1 It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
I read several possible solutions to the problem, mostly concerning IIS and virtual Directories or Applications.
The problem is, that I do not use IIS, but instead use the default Visual Studio Development Server.
What can I do to solve this problem?
I have tried a lot of different solutions available in the web, but either they did not quite fit onto my problem, or they did not work.
To recap my problem:
After switching CompileViews on, I immediately got the above error during compile.
I am using the default Visual Studio Development Server of VS2010 to test my MVC app.
Today I opened a request at Microsoft Developer support, and – I am almost ashamed to admit it – got my answer approximately 30 seconds into the callback from the technician:
All he said was: Please goto your obj folder and delete all contents. Then compile again.
And that really was all it took.
So after a lot of head-shaking about myself I wanted to share the results with you.