testfx
testfx copied to clipboard
Version conflict on Microsoft.Win32.Registry when multitargeting net8.0 and net48
I have some multi target libraries, which contains code for .NET 8 and .NET Standard 2.0.
The .NET Standard target is for some .NET Framework 4.8 applications. For that I use some AspNetCore 2.1 packages (which are still supported for this scenario, as I understand). On .NET 8 I use the FrameworkReference
with Microsoft.AspNetCore.App
.
My test project is targeting net8.0
and net48
to cover both platforms.
After upgrading MSTest.TestAdapter
and MSTest.TestFramework
from 3.5.1 to 3.6.0 and Microsoft.NET.Test.Sdk
from 17.10.0 to 17.11.1 I see some warnings in the output:
C:\Program Files\dotnet\sdk\8.0.400\Microsoft.Common.CurrentVersion.targets(2412,5): warning MSB3277:
Found conflicts between different versions of "Microsoft.Win32.Registry" that could not be resolved. [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
There was a conflict between "Microsoft.Win32.Registry, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "Microsoft.Win32.Registry, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
"Microsoft.Win32.Registry, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "Microsoft.Win32.Registry, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not. [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
References which depend on "Microsoft.Win32.Registry, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Users\USERNAME\.nuget\packages\microsoft.win32.registry\4.5.0\ref\net461\Microsoft.Win32.Registry.dll]. [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
C:\Users\USERNAME\.nuget\packages\microsoft.win32.registry\4.5.0\ref\net461\Microsoft.Win32.Registry.dll [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
Project file item includes which caused reference "C:\Users\USERNAME\.nuget\packages\microsoft.win32.registry\4.5.0\ref\net461\Microsoft.Win32.Registry.dll". [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
C:\Users\USERNAME\.nuget\packages\microsoft.win32.registry\4.5.0\ref\net461\Microsoft.Win32.Registry.dll [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
References which depend on or have been unified to "Microsoft.Win32.Registry, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" []. [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
C:\Users\USERNAME\.nuget\packages\microsoft.aspnetcore.dataprotection\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.DataProtection.dll [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
Project file item includes which caused reference "C:\Users\USERNAME\.nuget\packages\microsoft.aspnetcore.dataprotection\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.DataProtection.dll". [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
C:\Users\USERNAME\.nuget\packages\microsoft.aspnetcore.dataprotection\2.1.1\lib\netstandard2.0\Microsoft.AspNetCore.DataProtection.dll [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
C:\Users\USERNAME\.nuget\packages\microsoft.aspnetcore.authentication\2.1.2\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.dll [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
C:\Users\USERNAME\.nuget\packages\microsoft.testing.platform.msbuild\1.4.0\lib\netstandard2.0\Microsoft.Testing.Platform.MSBuild.dll [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
Project file item includes which caused reference "C:\Users\USERNAME\.nuget\packages\microsoft.testing.platform.msbuild\1.4.0\lib\netstandard2.0\Microsoft.Testing.Platform.MSBuild.dll". [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
C:\Users\USERNAME\.nuget\packages\microsoft.testing.platform.msbuild\1.4.0\lib\netstandard2.0\Microsoft.Testing.Platform.MSBuild.dll [C:\src\p\web\Dummy\test\Dummy.UnitTests\Dummy.UnitTests.csproj::TargetFramework=net48]
Do you have any suggestions how to deal with this?
I can't disable MSB3277
because sometimes there are "important" conflicts I have to know about.