HELP: Can not compile ASP.NET MVC project since setting MvcBuildViews=true


we have a quite complicated solution that also has one UI element tbuild no ASP.NET MVC 3. This started getting problematic because upon refactorings views are throwing errors on run time when not matching like due to a model change.

There is one item one can set in the project - MvcBuildViews. It triggers a compile of all views.and thus dhows all issseues at compile time. We did manage go get the following spree of bad errors sorted out (funny hiow many views we had without even a model left).

Sadly, TeamCity does not compile at all now ;)

This proejct compiles perfectly within visual studio.

It does not on build agents. The error message is:

D:\BuildAgent.2\work\XXX 2010 Trunk\vs\XXX\XXX.ControlCenter.UI\obj\release\csautoparameterize\original\web.config(44, 0): error ASPCONFIG: 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.

Anyone an idea how to get this compile on the build servers?

Comment actions Permalink

you could do something crude like this as a postbuild event

del $(ProjectDir)obj\$(ConfigurationName)\csautoparameterize\original\web.config
del $(ProjectDir)obj\$(ConfigurationName)\csautoparameterize\transformed\web.config
del $(ProjectDir)obj\$(ConfigurationName)\Package\packagetmp\web.config
del $(ProjectDir)obj\$(ConfigurationName)\transformwebconfig\original\web.config
del $(ProjectDir)obj\$(ConfigurationName)\transformwebconfig\transformed\web.config
exit 0

it is NOT a solution but merely a hack to get around the issue until you find out what the issue is


Comment actions Permalink

Sadly that did not help. It points into the right direction, though - it looks like TeamCity does not clean up properly, and the double eb.config are not getting ignored. I will try raising it as a bug.

Comment actions Permalink

Please check if build is running locally from MSBuild.exe? You may also check if it compiles on TeamCity build agent from the same user account.

There is a 'Clean sources' action in the build configuration tab to clean sources of the build.

If you want TeamCity to clean any produced by the build files, please consider using 'Swabra' build feature.

In the Paul post, is that truly 'post' step not 'pre' step?


Please sign in to leave a comment.