Steps to reproduce
dotnet publish works for -c Debug but gets ACCESS DENIED generating DLL for -c Release
Expected behavior
Build would work for either configuration
Actual behavior
-c Debug works but -c Release does not
Environment data
dotnet --info output:
Publish with -c Release fails with:
... publish: C:\Program Files\dotnet\sdk\2.2.105\Microsoft.Common.CurrentVersion.targets(4194,5): error MSB3021: Unable to copy file "obj\Release\netcoreapp2.1\Test.dll" to "bin\Release\netcoreapp2.1\Test.dll". Access to the path 'C:\Dev\Test\bin\Release\netcoreapp2.1\Test.dll' is denied. [C:\Dev\Test\Test.csproj]
Tracing with Process Monitor shows the the same PID for dotnet.exe opens the output DLL and then opens it again and gets ACCESS DENIED