Visual Studio 2010 / ASP.NET MVC / Publish
- by SevenCentral
I just did a clean install on Windows 7 x64 Professional with the final release of Visual Studio 2010 Premium. In order to duplicate what I'm experiencing do the following in:
Create a new ASP.NET MVC 2 Web Application
Right click the project and select Properties
On the Web tab, select "Use Local IIS Web Server"
Click on Create Virtual Directory
Save all
Unload the project
Edit the project file
Change MvcBuildViews to true
Save all
Reload project
Right click the project and select Publish
Choose the file system publish method
Enter a target location
Choose Delete all existing files
Select Publish
Right click the project
Select Publish
Each time I do the above I get the following errror:
"It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level..."
The error originates from obj\debug\package\packagetmp\web.config, relative to the project directory. I can repeat this all day long with any MVC 2 project I've built.
In order to fix this problem, I need to set MvcBuildViews to false in the project file. That's not really an option.
This wasn't a problem in Visual Studio 2008 and it seems to be an issue with the way the Publish command stages files beneath the project directory.
Can anyone else duplicate this error? Is this a bug or by design? Is there a fix, workaround, etc...?
Thanks.