Open shv07 opened 4 months ago
Have you tried following the Readme? https://github.com/excubo-ag/WebCompiler?tab=readme-ov-file#msbuild
This should be a good starting point for you. If MSBuild supports build on save, then this should work out of the box.
Thanks for the prompt reply. I had tried the approach in Readme as well. It didn't work (tried in both visual studio and in vscode with c# devkit. With that code, even the scss changes are not recompiled unless I do a rebuild.
However, if I modify the csproj to have BeforeTargets="PreBuildEvent"
in both places, then the compilation takes place without re-build on just running the project but still not on making changes during the debugging process.
My csproj looks like this:-
<Target Name="ToolRestore" BeforeTargets="PreBuildEvent">
<Exec Command="dotnet tool restore" StandardOutputImportance="high" />
</Target>
<Target Name="CompileStaticAssets" AfterTargets="AfterBuild">
<Exec Command="dotnet webcompiler -r wwwroot -c webcompilerconfiguration.json" StandardOutputImportance="high" />
</Target>
Thanks for your reply.
I would suggest asking this on stackoverflow, as there will be a larger crowd familiar with MSBuild. Ultimately, you want to invoke an arbitrary command (webcompiler in this case) on changes to a set of files (scss files). I'd expect this to be a supported use case in MSBuild.
Sure, will do that. I am using the cli meanwhile for updating the compilation during debugging.
Hi,
Is it possible to recompile scss on save by making changes in the csproj instead of running dotnet watch separately in a terminal? I tried to add this to csproj without any success. During the build, the project keeps getting restored and ultimately my visual studio crashes.