Monday, July 21, 2014

Reminder: If you develop WebForms, you should be doing this…

There are plenty of posts out there about using the aspnet_compiler.exe tool.

I’m not writing this to shed any new light on the subject. I'm writing this to remind developers that you should be using this tool… period.

It’s easy.

1. Add it as a Post Build event in your project:
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe -v / -p "$(ProjectDir)"

2. Add it as an MSBUILD target in your projects XML configuration:
<target name="AfterBuild">
    <message importance="high" text="Starting AspNetCompiler for $(ProjectName)" />
    <aspnetcompiler clean="true" debug="true" force="true" physicalpath="$(ProjectDir)" targetpath="$(ProjectDir)\obj\aspnet_compiler" virtualpath="/" />
    <message importance="high" text="Completed AspNetCompiler for $(ProjectName)" />

After enabling pre-compilation you may just find that your project has more issues that you previously thought.

It makes too much sense to not do this. It will save your butt at least once… I promise.

No comments:

Post a Comment