We have a legacy solution (>300 projects across several solutions) currently running in the old Xaml build definitions. I'm trying to convert it to the vNext build definitions, but I'm having intermittent errors.
Every so often, a file in the process will become locked, and cause the build to throw the following error:
CSC (0, 0) Metadata file 'E:\Builds\1\3\a\Newtonsoft.Json.dll' could not be opened -- The process cannot access the file 'xxx.dll' because it is being used by another process.
Its a different file every time (this latest was Newtonsoft.json.dll - a nuget package), and not always the same solution. Subsequent builds will work fine.
I've tried to resolve this by adding /NodeReuse:false to the build arguments, and whilst it appears to have reduced the frequency a little, it still hasn't resolved the issue.
Due to the nature of the build, and the fact it relies on the projects outputting to a common location (projects use a combination of File and Project references), I have the following settings configured:
/p:OutDir="$(build.stagingDirectory)" /p:ReferencePath="$(build.stagingDirectory)" /NodeReuse:False
It's almost always the Staging Directory that these dlls are located within.
Reconfiguring the product to exclusively use Project References is unfortunately not viable at this time.
Is there something I can do to the build step to eliminate these locking issues?