FS#71007 - [mono-msbuild] System.Reflection.Metadata 5.0.0.0 dependency is not satisfiable

Attached to Project: Community Packages
Opened by HebaruSan (HebaruSan) - Monday, 24 May 2021, 23:07 GMT
Last edited by Maxime Gauduin (Alucryd) - Thursday, 18 August 2022, 15:17 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Maxime Gauduin (Alucryd)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 15
Private No

Details

Description:

This package requires the System.Reflection.Metadata.dll assembly version 5.0.0.0 to function, see /usr/lib/mono/msbuild/Current/bin/MSBuild.dll.config :


<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>


However, this version of the DLL is not provided by this package or by Arch's Mono package, so installing this package results in failures for users who attempt to use it.


$ for F in $(find /usr/lib/mono -name System.Reflection.Metadata.dll -type f) ; do echo $F ; monodis --assembly $F | grep Version ; done
/usr/lib/mono/4.5/System.Reflection.Metadata.dll
Version: 1.4.3.0
/usr/lib/mono/msbuild/Current/bin/Sdks/ILLink.Tasks/tools/net472/System.Reflection.Metadata.dll
Version: 1.4.2.0
/usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/tools/net472/System.Reflection.Metadata.dll
Version: 1.4.2.0
/usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk.Razor/tasks/net46/System.Reflection.Metadata.dll
Version: 1.4.5.0


Steps to reproduce:

1. sudo pacman -S mono msbuild
2. Try to compile any C# project
3. Get error:


/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2198,5): error MSB3248: Parameter "AssemblyFiles" has invalid value "/usr/lib/mono/4.5-api/mscorlib.dll". Could not load file or assembly 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.


Side note, I am not primarily an Arch user. I installed it in a virtual machine to investigate repeated problem reports that have been submitted to a free project with which I try to help, see https://github.com/KSP-CKAN/CKAN/issues/3361 . It would be fantastic if this package could be fixed so other free software developers would not continue to receive bug reports for this.
This task depends upon

Closed by  Maxime Gauduin (Alucryd)
Thursday, 18 August 2022, 15:17 GMT
Reason for closing:  Fixed
Comment by Maxime Gauduin (Alucryd) - Monday, 21 June 2021, 07:52 GMT
Do you have dotnet-sdk installed? This particular version is shipped in that package.
Comment by HebaruSan (HebaruSan) - Monday, 21 June 2021, 13:09 GMT
I ran `sudo pacman -S mono msbuild`. If that installs dotnet-sdk, then I have it. If it doesn't, then I don't. If it doesn't and it should, then that would be a good fix for this.
Comment by Kenneth Hsu (warwickmm2) - Monday, 21 June 2021, 18:35 GMT
I am experiencing the same issue, and I have dotnet-sdk installed. Calling msbuild on a trivial solution results in the following error:

/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(2218,5): error MSB3248: Parameter "AssemblyFiles" has invalid value "/usr/lib/mono/4.5-api/mscorlib.dll". Could not load file or assembly 'System.Reflection.Metadata, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.


If I revert mono-msbuild to 16.8.xamarinxplat.2020.07.30.15.02-2, I don't encounter the error.


Additional info:

$ pacman -Qi mono
Name : mono
Version : 6.12.0.122-1
Description : Free implementation of the .NET platform including runtime and compiler
Architecture : x86_64
URL : https://www.mono-project.com/
Licenses : GPL LGPL2.1 MPL
Groups : None
Provides : monodoc
Depends On : zlib libgdiplus>=4.2 sh python ca-certificates
Optional Deps : None
Required By : dbus-sharp duplicati-latest gtk-sharp-2 mono-msbuild nuget nunit3-console
Optional For : rider
Conflicts With : monodoc
Replaces : None
Installed Size : 251.15 MiB
Packager : Giancarlo Razzolini <grazzolini@archlinux.org>
Build Date : Thu 17 Jun 2021 10:36:55 AM PDT
Install Date : Sat 19 Jun 2021 10:26:39 AM PDT
Install Reason : Installed as a dependency for another package
Install Script : Yes
Validated By : Signature

$ pacman -Qi mono-msbuild
Name : mono-msbuild
Version : 16.10.1.xamarinxplat.2021.05.26.14.00-1
Description : Xamarin implementation of the Microsoft build system
Architecture : x86_64
URL : https://github.com/mono/linux-packaging-msbuild
Licenses : MIT
Groups : None
Provides : msbuild
Depends On : mono
Optional Deps : None
Required By : None
Optional For : rider
Conflicts With : msbuild
Replaces : None
Installed Size : 44.41 MiB
Packager : Maxime Gauduin <alucryd@archlinux.org>
Build Date : Thu 17 Jun 2021 12:49:55 PM PDT
Install Date : Mon 21 Jun 2021 11:31:05 AM PDT
Install Reason : Explicitly installed
Install Script : No
Validated By : Signature

$ pacman -Qi dotnet-sdk
Name : dotnet-sdk
Version : 5.0.7.sdk204-1
Description : The .NET Core SDK
Architecture : x86_64
URL : https://www.microsoft.com/net/core
Licenses : MIT
Groups : None
Provides : dotnet-sdk-5.0
Depends On : dotnet-runtime dotnet-targeting-pack glibc gcc-libs netstandard-targeting-pack
Optional Deps : aspnet-targeting-pack: Build ASP.NET Core applications
Required By : None
Optional For : None
Conflicts With : dotnet-sdk-5.0
Replaces : None
Installed Size : 173.84 MiB
Packager : Maxime Gauduin <alucryd@archlinux.org>
Build Date : Thu 10 Jun 2021 01:56:33 PM PDT
Install Date : Sat 12 Jun 2021 08:57:43 AM PDT
Install Reason : Explicitly installed
Install Script : No
Validated By : Signature

$ for F in $(find /usr/lib/mono -name System.Reflection.Metadata.dll -type f) ; do echo $F ; monodis --assembly $F | grep Version ; done
/usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk.Razor/tasks/net46/System.Reflection.Metadata.dll
Version: 1.4.5.0
/usr/lib/mono/msbuild/Current/bin/Sdks/ILLink.Tasks/tools/net472/System.Reflection.Metadata.dll
Version: 1.4.2.0
/usr/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/tools/net472/System.Reflection.Metadata.dll
Version: 1.4.2.0
/usr/lib/mono/4.5/System.Reflection.Metadata.dll
Version: 1.4.3.0


Comment by Kenneth Hsu (warwickmm2) - Thursday, 24 June 2021, 19:19 GMT
I'm not certain, but I believe System.Reflection.Metadata version 5.0.0.0 was finally included in the rosalyn binaries here:

https://github.com/mono/roslyn-binaries/commit/1c6482470cd219dcc7503259a20f26a1723f20ec

The updated rosalyn binaries were picked up in the mono package here:

https://github.com/mono/mono/commit/20e5b164e7fe446ab58487eb2237652a53aefd37

It seems that some mono package dependencies were likely out of sync. It's possible that an updated version of mono will fix this issue. The following comment seems to indicate so:

https://github.com/KSP-CKAN/CKAN/issues/3361#issuecomment-847426156

Comment by Kenneth Hsu (warwickmm2) - Friday, 25 June 2021, 16:12 GMT
The version of System.Reflection.Metadata from rosalyn 3.7.0:

$ monodis --assembly System.Reflection.Metadata.dll
Assembly Table
Name: System.Reflection.Metadata
Hash Algoritm: 0x00008004
Version: 1.4.3.0
Flags: 0x00000001
PublicKey: BlobPtr (0x00002abb)
Dump:
0x00000000: 00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00
0x00000010: 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00
0x00000020: 07 D1 FA 57 C4 AE D9 F0 A3 2E 84 AA 0F AE FD 0D
0x00000030: E9 E8 FD 6A EC 8F 87 FB 03 76 6C 83 4C 99 92 1E
0x00000040: B2 3B E7 9A D9 D5 DC C1 DD 9A D2 36 13 21 02 90
0x00000050: 0B 72 3C F9 80 95 7F C4 E1 77 10 8F C6 07 77 4F
0x00000060: 29 E8 32 0E 92 EA 05 EC E4 E8 21 C0 A5 EF E8 F1
0x00000070: 64 5C 4C 0C 93 C1 AB 99 28 5D 62 2C AA 65 2C 1D
0x00000080: FA D6 3D 74 5D 6F 2D E5 F1 7E 5E AF 0F C4 96 3D
0x00000090: 26 1C 8A 12 43 65 18 20 6D C0 93 34 4D 5A D2 93
Culture:


The version of System.Reflection.Metadata from rosalyn 3.9.0 (updated in https://github.com/mono/roslyn-binaries/commit/1c6482470cd219dcc7503259a20f26a1723f20ec):

$ monodis --assembly System.Reflection.Metadata.dll
Assembly Table
Name: System.Reflection.Metadata
Hash Algoritm: 0x00008004
Version: 5.0.0.0
Flags: 0x00000001
PublicKey: BlobPtr (0x00002b18)
Dump:
0x00000000: 00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00
0x00000010: 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00
0x00000020: 07 D1 FA 57 C4 AE D9 F0 A3 2E 84 AA 0F AE FD 0D
0x00000030: E9 E8 FD 6A EC 8F 87 FB 03 76 6C 83 4C 99 92 1E
0x00000040: B2 3B E7 9A D9 D5 DC C1 DD 9A D2 36 13 21 02 90
0x00000050: 0B 72 3C F9 80 95 7F C4 E1 77 10 8F C6 07 77 4F
0x00000060: 29 E8 32 0E 92 EA 05 EC E4 E8 21 C0 A5 EF E8 F1
0x00000070: 64 5C 4C 0C 93 C1 AB 99 28 5D 62 2C AA 65 2C 1D
0x00000080: FA D6 3D 74 5D 6F 2D E5 F1 7E 5E AF 0F C4 96 3D
0x00000090: 26 1C 8A 12 43 65 18 20 6D C0 93 34 4D 5A D2 93
Culture:
Comment by Jack (ostroffjh) - Thursday, 08 July 2021, 03:18 GMT
I just installed mono-nightly (Mono JIT compiler version 6.13.0.588 (tarball Wed Jul 7 08:22:20 PM EDT 2021)) and still have the same problem, and monodis still shows the old version. Is there any way to actually get the new version into a current system? This is a total show stopper for me.
Comment by Kenneth Hsu (warwickmm2) - Thursday, 08 July 2021, 17:08 GMT
According to https://download.mono-project.com/sources/mono/nightly/, version 6.13.0.588 is from 2020-06-07 09:06, so it's too old. You can try updating the PKBUILD to get a newer version, or try mono-git. I checked mono-6.13.0.1176.tar.xz and it has System.Reflection.Metadata version 5.0.0.0.
Comment by Jack (ostroffjh) - Thursday, 08 July 2021, 17:47 GMT
Just to confirm, mono-git (6.12.0.147.r1326.e44d84d10a0-1, although mono --version says 6.13.0) does work. I would have expected mono-daily to do the same, but I suppose I'll have to bring that up on AUR, not here.
Comment by Hywel Thomas (hwthomas) - Monday, 30 August 2021, 16:50 GMT
>Do you have dotnet-sdk installed? This particular version is shipped in that package.

I have installed dotnet-host-bin and dotnet-sdk-bin from AUR, which provides host-5.0, sdk-5.0, runtime-5.0, etc.
mono and msbuild are *not* installed with the dotnet packages.

Installing mono-msbuild and mono-msbuild-sdkresolver from the Community repository, I encounter the same problem as reported above.
I am currently using their workaround (https://github.com/KSP-CKAN/CKAN/issues/3361) which extracts the System.Reflection.Metadata.dll from the debian mono-msbuild package (https://www.mono-project.com/download/preview/) and copies it to /usr/lib/mono/4.5/
Comment by Alexandre ZANNI (noraj) - Friday, 17 December 2021, 19:20 GMT
I have the same issue trying to compile any C# project


mono 6.12.0.122
msbuild 16.10.1.xamarinxplat.2021.05.26.14.00
dotnet sdk 6.0.0.sdk100
nuget 5.10.0


https://github.com/cobbr/SharpSploit/issues/76 & https://github.com/tevora-threat/SharpView/issues/8
Comment by Grant Moyer (GrantMoyer) - Friday, 18 February 2022, 04:11 GMT
Using the official PKGBUILD for the mono package, but bumping the version to 6.12.0.173 (the latest tagged version at time of writing, and the preview release according to mono-project.com) solved the issue for me.
Comment by Fabio (FabioLolix) - Thursday, 23 June 2022, 20:21 GMT
I had the same problem, which was solved with the update of the Arch mono package to version 6.12.0.177 https://github.com/duplicati/duplicati/issues/4680

Loading...