Closed bradwilson closed 8 months ago
Note: 2.0.22 does not fail on Windows. 2.0.21 does not fail anywhere.
I notice that xunit.v3.runner.msbuild.dll depends on Microsoft.Build.Framework.dll:
During the build, this .dll is being picked up from Microsoft.NETFramework.ReferenceAssemblies:
Here's what I think we should do: copy Microsoft.Build.Framework.dll to output and exclude it from merging (such that when MSBuild uses it it has the same types):
Here's a PR: https://github.com/xunit/xunit/pull/2858
Alternatively, you could pass the path to $(PkgMicrosoft_NETFramework_ReferenceAssemblies)1.0.3/build/.NETFramework/v4.7.2/Microsoft.Build.Framework.dll
as a /lib:
argument to ILRepack.exe so that it can resolve the dll from there.
I actually have no idea why 2.0.21 works. Somehow ILRepack is able to grovel through all the assemblies without needing to resolve Microsoft.Build.Framework.dll. But something changed in 2.0.22 so now ILRepack hits something which requires it to go look up Microsoft.Build.Framework.dll. Since it's a legitimate request to want to inspect a reference to be able to analyze an assembly, I don't think there's anything wrong with 2.0.22. 2.0.21 had the privilege but didn't use it? 2.0.22 decided to be pickier somehow?
I did change the resolve for 2.0.22 to be able to look up .NET Core assemblies, before it didn't have that capability.
OH! I know. 2.0.21 uses mono, and Mono contains Microsoft.Build.Framework.dll in the GAC, so ILRepack resolves it from the GAC.
When using .NET, it has no GAC, so it can't resolve it any more.
I like the lib strategy, I can key it off $(TargetFrameworkRootPath)
and then I don't have to worry about making private copies and adding exclusions if this ever surfaces again. I tried this on Linux and it works, then tried it on Windows so I could use ILSpy to verify that the MSBuild assemblies weren't part of the merge:
Looks good. 👍🏼 I'm going to amend your xunit/xunit PR with this and merge it. Thanks!
After updating to 2.0.22 (and switching from
mono
todotnet
for invocation), my Linux builds are now failing to findMicrosoft.Build.Framework
.Repro steps:
git clone https://github.com/xunit/xunit
git switch -d c0730016289d6418cc8d28c61f7c2f96b1a8336f
(this is wheremain
is as of the writing of this bug)dotnet build src/xunit.v3.runner.msbuild
Results:
dotnet --info
: