Question

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?

Was it helpful?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top