Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Always run post build event commands in visual studio 2017

Currently, when I run my project, it will execute my post-build commands that I have set up. However, this is only true if there was a change to the project. My ultimate goal here is to have my project run ng build each time I build it. However, what I have noticed is that if I were to change an HTML file in angular, the project does not detect any changes so it does not build again and thus it does not run my ng build command.

Is there a way to force it to always run post-build commands or maybe make it always rebuild, even if no changes are detected? Or maybe there is another way to accomplish this?

This is a .NET Core WebApp and the code to run my post build event is located inside my .csproj file

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="echo Building Angular App..." />
    <Exec Command="cd ClientApp &amp;&amp; ng build" />
</Target>
like image 732
Bagzli Avatar asked Jul 08 '18 02:07

Bagzli


1 Answers

I have solved this by adding the following properties to my project file

<RunPostBuildEvent>Always</RunPostBuildEvent> 
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>

Somebody else had this posted as an answer but deleted for some reason so I am re-posting it so anyone that comes along in future can see how I solved it.

like image 113
Bagzli Avatar answered Oct 24 '22 07:10

Bagzli