MSBuild bug and web projects pt2
More MSBuild pain, this time by way of the aspnet_compiler. Take a web project, some pages are nonsecure, some pages are secure and need forms authentication before you see them. Lets assume the project not in the IIS wwwroot directory either.
In the web config you then assign forms authentication using
<forms name=".LOGIN" loginUrl="login.aspx" protection="All" timeout="60" path="secure"/>
If you compile this in VS2005 is fails with the following.
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.
To fix this we make the secure directory a virtual directory in IIS, our project root is a virtual directory and so is the secure directory. You then compile this and it works, all good. Now more fun begins. If you build in MSBuild then we it gets the aspnet_compiler stage it fails with the same error. If you create one of the new fangled web projects it also fails when it reaches the aspnet_compiler stage. At this point no matter much you try it refuses to budge.
More interestingly if you look at VS2005 it hides the contents of secure and when you click them asks you if you want to add them to the project or view out side of the project, doing either option fails your build inside of VS2005, thanks very much.
Update: check this for how to resolve this.