title: Precompile ASP.NET MVC views on Azure Web App
body: <p>Is there a way to precompile the ASP.NET MVC views on an Azure Web App (specifically when published via Release Management on VSTS)?</p>
  
  <p>Once each view has been hit once, the page subsequently renders very quickly. But that first delay can be a doozy for users and there's no way to script touching each page. </p>
  
  <p>I'm not sure if I need to change something in the build/release processes on VSTS (I am using the <code>Visual Studio Build</code> build step and the <code>Azure Web App</code> release task) or if I need to run something on the Azure Web App instance after it is released (or something else altogether).</p>
  
  <p>It seems like finding some way to call <code>aspnet_compiler</code> after publish might be what I need (and I have seen that in reference to Web Roles on Cloud Services) but I can't get that to work. </p>
  
  <p>Calling </p>
  
  <pre><code>%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler -v "/" -p "d:\home\site\wwwroot" 
  </code></pre>
  
  <p>via the Console in the Azure Portal executes just fine (and finds errors if there are any) but doesn't have any impact on startup time - hitting a view the first time still takes a long time. </p>
  
  <p>So maybe that isn't the right direction.</p>
  
  <p>I've looked at RazorGenerator (including the .MSBuild nuget package) and I couldn't quite get it to work, but really I was hesitant to make so many changes to the projects just to get precompilation on release.</p>
  
  <p>Also note that I am currently using TFVC, not Git, in VSTS, so the Kudu/Git integration (that does seem to trigger the precompilation according to some articles) isn't available to me as far as I can tell.</p>
  
  <p>Other ideas?</p>