Target framework attribute file should be written to IntermediateOutputPath · Issue #1479 · dotnet/msbuild (original) (raw)

Currently GenerateTargetFrameworkMonikerAttribute defaults to write the target framework attribute file to %TEMP%. This means if multiple projects are building at once and the file doesn't exist, they can hit a race condition. The currently solution is to have the <WriteLinesToFile /> task marked to ContinueOnError which emits a warning.

I propose that we instead default to have the target framework attribute file be written to the IntermediateOutputPath which in most cases would be unique per project. The overhead on small projects would be very minimal and in large projects they would no longer have the race condition. I would change this line to say:

([System.IO.Path]::Combine(′([System.IO.Path]::Combine('([System.IO.Path]::Combine((IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))

FYI @jaredpar