Sunday, May 23, 2010, 8:40 PM in .NET
Spurious MachineToApplication Error With VS2010 Deployment
Often when I'm building my MVC 2 application using Visual Studio 2010, I get the following error:
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.
On the internet, this error seems to be related to having a nested web.config in your application. I do have such a thing, but it's just the one that came out of the MVC 2 project item template and I haven't touched it.
In my case, this error in my case doesn't seem to have anything to do with a nested web.config. This error only started to happen when I began using the web site deployment features in VS2010 which by itself, rocks (see Scott Hanselman's "Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong" for details).
If it happens to you and it doesn't seem to make any sense, you can try to fix it with a Build Clean command. If you're using to previous versions of Visual Studio, you'll be surprised, like I was, not to find a Clean option in sparse the Build menu. Instead, you can only get to it by right-clicking on your project in the Solution Explorer and choosing Clean.
Doing that, however, seems to make the error go away. I don't think that's a problem with my app; I think that's a problem with VS2010.
8 comments
on this post
Eduardo:
Monday, May 24, 2010, 5:47 AM
Chris Sells:
Monday, May 24, 2010, 6:45 AM
Eduardo:
Monday, May 24, 2010, 8:18 AM
Kazi Manzur Rashid:
Monday, May 24, 2010, 5:02 PM
Eduardo:
Wednesday, Jun 9, 2010, 2:21 PM
Dan:
http://stackoverflow.com/questions/2566215/allowdefinitionmachinetoapplication-error-when-publishing-from-vs2010-but-onl
It's caused by some weird thing to do with buidling of the deployment and the web.config that gets put into the OBJ folder. So set the "BaseIntermediateOutputPath" folder to a place outside of your project.
You have to add a line to the project.
<BaseIntermediateOutputPath>[SomeKnownLocationIHaveAccessTo]</BaseIntermediateOutputPath>
Monday, Jun 21, 2010, 5:39 AM
Chris Sells:
http://connect.microsoft.com/VisualStudio/feedback/details/556312/mvcbuildviews-does-not-play-well-with-one-click-publish
Thursday, Nov 4, 2010, 7:05 PM
Roger:
Thursday, Jul 21, 2011, 3:47 AM



