When I'm building the application, one of the PreBuildEvents is the build of the React front-end:
<PropertyGroup>
<PreBuildEvent>
powershell.exe "npm --prefix """$(ProjectDir)Scripts\client""" run build"
</PreBuildEvent>
</PropertyGroup>
Which overwrites the Project\Scripts\client\build
As part of the build I include the build folder in the project:
<Content Include="Scripts\client\build\**" />
However, towards the end of the build, I get an error:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets(182,5):
error MSB3030: Could not copy the file "Scripts\client\build\precache-manifest.639e62e5c73567fc96d77fd52068e2d7.js"
because it was not found.
The problem is that the Scripts\client\build\precache-manifest.639e62e5c73567fc96d77fd52068e2d7.js was the file in the build folder before the PreBuildEvent was executed, after the PreBuildEvent was run the file is Scripts\client\build\precache-manifest.9fab5f56d5c8f9561b6f289e96f4a80e.js.
This problem just randomly started to happen recently, and seems to persist even if the entire repo is reverted 50+ versions back, and the issue is replicable across multiple computers running different versions of Visual Studio (2017 & 2019)