title: How to get aspnet_compiler invoked from Visual Studio during build?
body: <p>I want Visual Studio to <a href="https://stackoverflow.com/q/12496714/57428">precompile my ASP.NET application</a> which is used as an Azure web role payload. So I've found <a href="http://blog.dotsmart.net/2012/09/14/build-views-command-for-visual-studio/" rel="nofollow noreferrer">this post</a> that explains how to call aspnet_compiler to validate views.</p>
  
  <p>I tried to add the following to "post-build event" of my ASP.NET application:</p>
  
  <pre><code>call "%VS100COMNTOOLS%\vsvars32.bat"
  aspnet_compiler -v / -p $(ProjectDir)
  </code></pre>
  
  <p>or alternatively this (application name specified explicitly):</p>
  
  <pre><code>call "%VS100COMNTOOLS%\vsvars32.bat"
  aspnet_compiler -v /ASP.NET-Application-ProjectNameHere -p $(ProjectDir)
  </code></pre>
  
  <p>In both cases when the build runs I see the following in the build output:</p>
  
  <pre><code>Setting environment for using Microsoft Visual Studio 2010 x86 tools.
  Utility to precompile an ASP.NET application
  Copyright (C) Microsoft Corporation. All rights reserved.
  </code></pre>
  
  <p>and clearly no precompilation happens because if I change any .aspx or .cshtml file "Build Action" to "None" it doesn't get to the Azure service package and the view no longer opens once the package is deployed to Azure.</p>
  
  <p>How do I setup aspnet_compiler for precompiling from within Visual Studio?</p>