-
Notifications
You must be signed in to change notification settings - Fork 341
Description
Description
I have a project (https://github.com/dotnet/upgrade-assistant) that loads MSBuild from an available source and lets that run how it will. Tests employing this fail when moving to .NET 6 because the test framework has already loaded an (old) version of the NuGet.Frameworks library.
System.IO.FileLoadException: Could not load file or assembly 'NuGet.Frameworks, Version=6.0.0.220, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (0x80131621)
I've verified that before the tests start, NuGet.Frameworks
is already loaded. This worked fine when it was a .NET 5 version of msbuild as the versions aligned. This can be fixed by adding the following line to the test project file:
<ItemGroup>
<!-- The test framework brings in an old NuGet.Frameworks that ends up getting used rather than what MSBuild wants -->
<PackageReference Include="NuGet.Frameworks" Version="6.0.0-rc.258" />
</ItemGroup>
I see a PR opened that is still in draft mode to address this (#2544). For anyone that is trying to test something that uses MSBuild, they'll probably hit this and end up spending too much time fiddling with things to figure out what is going on.