Skip to content

Instantly share code, notes, and snippets.

@matthewrwilton
Created March 12, 2017 12:49
Show Gist options
  • Save matthewrwilton/0e17346f7118fe39eebe311853abad79 to your computer and use it in GitHub Desktop.
Save matthewrwilton/0e17346f7118fe39eebe311853abad79 to your computer and use it in GitHub Desktop.
Example of Exec task usage to compile ASP.NET razor views and exclude the node_modules folder.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<Exec Command="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v temp -p $(WebProjectOutputDir) -x node_modules"/>
</Target>
...
</Project>
@pallarim
Copy link

pallarim commented Jan 5, 2018

Thank you for this. This helped me a lot. However, I changed the hardcoded path to "$(FrameworkDir)$(FrameworkVersion)\aspnet_compiler.exe"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment