10. mei 2016 15:46 by martijn
We all know and love the MvcBuildViews settings you can add to your project to enable compilation of views during build. But sometimes this does not give you the desired result and it slows down your build considerably. An alternative is to invoke the view compilation on demand by configuring it as a external tool.
This is actually quite easy to do and integrates nicely with VS. In the screenshot below you see how to configure an external tool for this. The only thing that is not in the screenie is the path to the aspnet_compiler.exe which is invoked. The path i have is C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe but this obviously depends on the version of .net your are using.
To invoke it just select your web project and click Tools -> Compile views. The cool thing is that VS opens the file with the error once you doubleclick a line. Sweet :)