Closed Flixbox closed 4 years ago
HI @Flixbox,
That is an interesting issue. The Target
is configured to run after CoreCompile
, so it should only run on compile, never without prompting. Excubo.WebCompiler
doesn't watch for any changes itself: it will only ever process each file once and then the process will terminate. So the tool itself won't cause this behavior.
My conclusion therefore is that something in your project setup must cause a compilation. You could experiment with different values for the AfterTargets
property: here's a list of possible values, to see whether any other value still compiles your files, without doing it unprompted.
Intriguing! My issue is completely solved!
With an AfterTargets
value of CoreCompile
, the entire project keeps recompiling over and over as long as VS is open. I deleted my bin/Debug
folder and it was back within seconds.
However, changing the AfterTargets
value to AfterBuild
completely removes this loop and works wonderfully:
<Target Name="CompileStaticAssets" AfterTargets="AfterBuild">
<Exec Command="dotnet tool run webcompiler -r wwwroot/js wwwroot/scss wwwroot/lib -z disable -p disable -o wwwroot/out" StandardOutputImportance="high" />
</Target>
Thanks a lot for your great assistance!
Here's a screen recording of the issue in my Visual Studio. In the video I'm deleting a few files and they keep reappearing. The same thing happens when I delete them from the file explorer.
My .csproj file has the following lines in it:
Basically, the moment I start my Visual Studio (I don't even need to run my program), the minified files are immediately being regenerated in a loop.
Sometimes the loop pauses for a few seconds. I can delete a few files, but as long as Visual Studio is open, the files are being generated.
I thought that maybe LibMan or "Format Document on Save" were at fault, but when I disabled these extensions there was no change in behaviour.