views:

54

answers:

1

Whenever I publish my MVC web application in VS 2010 via the One-click publish feature (I'm not doing any web.config transforms or anything fancy - yet!). The next time I come to build the app 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. in ...MyWebApp\obj\release\package\packagetmp \web.config

A new copy of the web.config file is indeed created by VS2010 below the ...MyWebApp\obj\ folder so I deleted the whole obj folder and I was then able to build again.

But I shouldn't have to do that each time I publish - I must have something configured incorrectly - can anyone help please.

Thanks.

+1  A: 

I have just found a work around for this that has worked for me, open the .csproj for your web project and change the node under the Project\PropertyGroup node to this:

from this: <MvcBuildViews>true</MvcBuildViews>

to this: <MvcBuildViews>false</MvcBuildViews>

This has worked for me, hopefully it will work for you also.

DotNetHacker
Note that while this does work around this problem, it means that you no longer get compile-time validation of your views - for me this is a deal breaker.
Simon Steele