runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Release-only build has errors due to ResolvedMatchingContract when re-compiling in Visual Studio

Open steveharter opened this issue 2 years ago • 0 comments

When opening a library project with Visual Studio against a previously-build release-only (runtime and libraries) build the following error occurs:

Error		ResolvedMatchingContract 'C:\git\runtime\artifacts\bin\System.Private.CoreLib\ref\Debug\net7.0\System.Private.CoreLib.dll' did not exist.	System.Private.CoreLib	C:\Users\sharter\.nuget\packages\microsoft.dotnet.apicompat\8.0.0-beta.22455.1\build\Microsoft.DotNet.ApiCompat.targets	35	

So it is trying to use the debug version of System.Private.CoreLib (which does not exist) instead of the release version.

Not sure if this applies to all libraries or not.

Repro

On a clean enlistment:

build -s clr+libs+libs.tests -c Release
  • Open C:\git\runtime\src\libraries\System.Reflection\System.Reflection.sln in VS
  • Change build to release
  • Build

Result: the above error plus attempting to run the tests from withing VS results in a silent failure because the default is to not run when there is a build error. The Test error output shows:

Aborting test run due to build failures. Please see the build output for more details.

steveharter avatar Sep 20 '22 15:09 steveharter