dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.46k stars 4.76k forks source link

Version conflicts while building runtime repo in source-build config #109120

Open tmds opened 1 month ago

tmds commented 1 month ago

This issue has appeared in our internal CI since 68ef461c8a3af6b04267053deed4f3fb116f715e.

When building the repo with this command:

./build.sh /p:NoPgoOptimize=true --portablebuild false /p:DotNetBuildFromSource=true /p:DotNetBuildSourceOnly=true /p:DotNetBuildTests=true --cmakeargs -DCLR_CMAKE_USE_SYSTEM_BROTLI=true --cmakeargs -DCLR_CMAKE_USE_SYSTEM_ZLIB=true --runtimeconfiguration Release --librariesConfiguration Debug --subset clr+libs+host+packs+libs.tests

The build fails with:

Build FAILED.

error MSB3277: Found conflicts between different versions of "System.Collections.Immutable" that could not be resolved. [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277: There was a conflict between "System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Collections.Immutable, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:     "System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Collections.Immutable, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not. [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:     References which depend on "System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [/home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Collections.Immutable.dll]. [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:         /home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Collections.Immutable.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:           Project file item includes which caused reference "/home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Collections.Immutable.dll". [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:             /home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Collections.Immutable.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:     References which depend on or have been unified to "System.Collections.Immutable, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" []. [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:         /home/tester/.nuget/packages/microsoft.build/17.8.3/ref/net8.0/Microsoft.Build.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:           Project file item includes which caused reference "/home/tester/.nuget/packages/microsoft.build/17.8.3/ref/net8.0/Microsoft.Build.dll". [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:             /home/tester/.nuget/packages/microsoft.build/17.8.3/ref/net8.0/Microsoft.Build.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:         /home/tester/.nuget/packages/microsoft.build.framework/17.8.3/ref/net8.0/Microsoft.Build.Framework.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:           Project file item includes which caused reference "/home/tester/.nuget/packages/microsoft.build.framework/17.8.3/ref/net8.0/Microsoft.Build.Framework.dll". [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:             /home/tester/.nuget/packages/microsoft.build.framework/17.8.3/ref/net8.0/Microsoft.Build.Framework.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:             /home/tester/.nuget/packages/microsoft.build/17.8.3/ref/net8.0/Microsoft.Build.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:             /home/tester/.nuget/packages/microsoft.build.utilities.core/17.8.3/ref/net8.0/Microsoft.Build.Utilities.Core.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:         /home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:           Project file item includes which caused reference "/home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll". [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:             /home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277: Found conflicts between different versions of "System.Reflection.Metadata" that could not be resolved. [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277: There was a conflict between "System.Reflection.Metadata, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Reflection.Metadata, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:     "System.Reflection.Metadata, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Reflection.Metadata, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not. [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:     References which depend on "System.Reflection.Metadata, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [/home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Reflection.Metadata.dll]. [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:         /home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Reflection.Metadata.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:           Project file item includes which caused reference "/home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Reflection.Metadata.dll". [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:             /home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Reflection.Metadata.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:     References which depend on or have been unified to "System.Reflection.Metadata, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" []. [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:         /home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:           Project file item includes which caused reference "/home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll". [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277:             /home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll [/home/tester/runtime/src/tasks/Crossgen2Tasks/Crossgen2Tasks.csproj]
error MSB3277: Found conflicts between different versions of "System.Collections.Immutable" that could not be resolved. [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277: There was a conflict between "System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Collections.Immutable, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:     "System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Collections.Immutable, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not. [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:     References which depend on "System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [/home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Collections.Immutable.dll]. [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:         /home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Collections.Immutable.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:           Project file item includes which caused reference "/home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Collections.Immutable.dll". [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:             /home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Collections.Immutable.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:     References which depend on or have been unified to "System.Collections.Immutable, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" []. [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:         /home/tester/.nuget/packages/microsoft.build/17.8.3/ref/net8.0/Microsoft.Build.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:           Project file item includes which caused reference "/home/tester/.nuget/packages/microsoft.build/17.8.3/ref/net8.0/Microsoft.Build.dll". [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:             /home/tester/.nuget/packages/microsoft.build/17.8.3/ref/net8.0/Microsoft.Build.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:         /home/tester/.nuget/packages/microsoft.build.framework/17.8.3/ref/net8.0/Microsoft.Build.Framework.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:           Project file item includes which caused reference "/home/tester/.nuget/packages/microsoft.build.framework/17.8.3/ref/net8.0/Microsoft.Build.Framework.dll". [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:             /home/tester/.nuget/packages/microsoft.build.framework/17.8.3/ref/net8.0/Microsoft.Build.Framework.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:             /home/tester/.nuget/packages/microsoft.build/17.8.3/ref/net8.0/Microsoft.Build.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:             /home/tester/.nuget/packages/microsoft.build.utilities.core/17.8.3/ref/net8.0/Microsoft.Build.Utilities.Core.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:         /home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:           Project file item includes which caused reference "/home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll". [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:             /home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277: Found conflicts between different versions of "System.Reflection.Metadata" that could not be resolved. [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277: There was a conflict between "System.Reflection.Metadata, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Reflection.Metadata, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:     "System.Reflection.Metadata, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Reflection.Metadata, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not. [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:     References which depend on "System.Reflection.Metadata, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [/home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Reflection.Metadata.dll]. [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:         /home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Reflection.Metadata.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:           Project file item includes which caused reference "/home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Reflection.Metadata.dll". [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:             /home/tester/runtime/.dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0-rc.2.24473.5/ref/net9.0/System.Reflection.Metadata.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:     References which depend on or have been unified to "System.Reflection.Metadata, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" []. [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:         /home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:           Project file item includes which caused reference "/home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll". [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
error MSB3277:             /home/tester/.nuget/packages/system.reflection.metadataloadcontext/10.0.0-alpha.1.24504.10/lib/netstandard2.0/System.Reflection.MetadataLoadContext.dll [/home/tester/runtime/src/tasks/installer.tasks/installer.tasks.csproj::TargetFramework=net9.0]
    0 Warning(s)
    4 Error(s)

When doing the build locally, I get the same error. When then running the same command again, the build passes without an error.

cc @ViktorHofer @omajid

tmds commented 1 month ago

TargetFramework=net9.0]

I guess this problem might disappear when the main branch moves further down the .NET 10 path. These projects have a NetCoreAppToolCurrent target that is using net9.0.

I'm not sure why it doesn't affect the vmr builds for .NET 10.

cc @MichaelSimons

dotnet-policy-service[bot] commented 1 month ago

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries See info in area-owners.md if you want to be subscribed.