Visual Studio Workaround for locked files when trying to build - serenity-is/Serenity GitHub Wiki
Hi all,
very often with newer Serenity FW builds, some of us have the problem that when trying to do a build (quickly after some previous builds already done) Visual Studio alerts that it could not delete some files because some process is still accessing them.
This seems to be a general problem with Visual Studio. See this issue here:https://developercommunity.visualstudio.com/content/problem/221300/warning-msb3061-unable-to-delete-file.html
The workaround for this is, to kill the "VBCSCompiler.exe" process in the pre-build events.
For this, (1) Right-click your project in the Solution Explorer --> Properties (2) Click on "Build Events" (3) In the Pre-Build event command line windows, paste the following two lines:
taskkill /IM "VBCSCompiler.exe" /F 2>nul 1>nul
exit 0
This makes sure that the VBCSCompiler.exe gets killed before a build starts because this app keeps sometimes a lock on some of the files.
Hope this helps :-)
With kind regards,
John