Search code examples
msbuildaspnet-compiler

When I run msbuild, it makes a call to aspnet_compiler, but doesn't compile my site


I have created a custom .proj file that builds my web site project's solution. It seems to all work correctly and it produces an output. However, when I put it on the server, I got an error about "/Default.aspx is not precompiled and cannot be requested". After some digging I discovered that indeed the precompiled aspx files were not precompiling. In the output from msbuild, I found a call to aspnet_compiler:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /WebApplication -p WebApplication\ -f -fixednames Output_PublishedWebsites\WebApplication\

When I run this command directly, it generates everything just fine.

How can I get my msbuild wrapper to perform this correctly?

My msbuild task looks like this:

<MSBuild Projects="$(SolutionFile)"
         Properties="OutDir=$(OutputRoot);
                     Configuration=$(AspNetConfiguration)"
         Targets="Build" />

Solution

  • I solved this by using the <AspNetCompiler /> task.