Search code examples
asp.netvisual-studio-2010azureazure-web-rolesaspnet-compiler

Why does this call to aspnet_compiler not produce new .NET assemblies?


I'm trying to make Visual Studio precompile my ASP.NET application that will be deployed on Azure. I've added the following to my .csproj file:

<Target Name="AfterBuild">
    <Message Text="Starting AspNetCompiler for $(ProjectDir)" Importance="high" />
    <AspNetCompiler
        VirtualPath="/"
        PhysicalPath="$(ProjectDir)"
    />
</Target>

Now when I ask Visual Studio to prepare a service package the following appears in the build output:

Starting AspNetCompiler for [PathToMyProject]
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p [PathToMyProject]

If I plant an error in any of the view files that error is identified and breaks the build so clearly the precompilation is perfomed.

Yet I don't see any new .NET assemblies anywhere in the results.

How do I make ASP.NET compiler create the .NET assemblies for the views?


Solution

  • If you don't specify an output directory you should find the output in this folder:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\some-random-id (try sorting on the date modified to find the latest directory).

    When calling the aspnet_compiler.exe you can also append an output folder to the command:

    aspnet_compiler -v "/" -p "C:\Projects\WebApplication1\WebApplication1" C:\CompileOutput
    

    Here you see the output in my C:\CompiledOutput folder

    enter image description here