NuGet product used: NuGet.exe
NuGet version (x.x.x.xxx): tested in 4.5.1.4879 and 5.0.0.5923 (affects both)
dotnet.exe --version (if appropriate): 2.1.602 (it was working fine in 2.1.505)
OS version: Ubuntu Linux 18.04
Worked before?: yes, but with previous .NET Core SDK version
Error MSB4018: The "GenerateDepsFile" task failed unexpectedly. [/builds/DiginexGlobal/geewallet/src/GWallet.Backend.NetStandard/GWallet.Backend.NetStandard.fsproj]
/usr/share/dotnet/sdk/2.1.602/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018: System.TypeLoadException: Could not load type of field 'Microsoft.NET.Build.Tasks.DependencyContextBuilder:_filteredPackages' (12) due to: Could not resolve type with token 01000025 from typeref (expected class 'NuGet.Packaging.Core.PackageIdentity' in assembly 'NuGet.Packaging, Version=5.0.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35') assembly:NuGet.Packaging, Version=5.0.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type:NuGet.Packaging.Core.PackageIdentity member:(null)
verbosity=detail logs: https://gitlab.com/DiginexGlobal/geewallet/-/jobs/190353486
clone https://gitlab.com/knocte/geewallet , switch to the frontend branch, edit the file ./scripts/install_dotnet_sdk_from_microsoft_deb_packages.sh to remove the workaround to install an older version of .NET Core (replacing dotnet-sdk-2.1=2.1.505-1 with just dotnet-sdk-2.1) and compile it with ./configure.sh && make.
VS4Mac 7.8 and Mono 4.16 (?) and .NET Core SDK 2.1.602 or 2.2.202 have a problem.
We've removed the download for the Mac installers of those 2 SDKs, to avoid this problem.
Longer term, in VS4Mac8.x and Mono 4.18 (?), mono/msbuild should properly enforce loading compatible SDKs. 2.1.602 and 2.2.202 should only be loaded in an msbuild 16.0 environment.
This problem is showing up because we moved all the types from NuGet.Packaging.Core.dll to NuGet.Packaging.dll, and left type forwarders in NuGet.Packaging.Core.dll.
This works ok on full .NET Framework...but fails to work ok in Mono/VS4Mac7.8 -- since Mono cannot support loading NuGet 4.8 and NuGet 5.0. Since NuGet 4.8 loads first (likely to do TFM compat checking for msbuild), NuGet 5.0 cannot be loaded.
We'll try to link to the Mono issues for fixes soon.
VS4Mac 7.8 and Mono 4.16 (?)
I'm reproducing this problem with Mono 5.18, the current stable version.
We've removed the download for the Mac installers of those 2 SDKs, to avoid this problem.
Can you do the same with Linux please? Remove the .deb files from the server.
since Mono cannot support loading NuGet 4.8 and NuGet 5.0. Since NuGet 4.8 loads first (likely to do TFM compat checking for msbuild), NuGet 5.0 cannot be loaded.
So if I use Nuget 4.8, this might workaround the problem? If yes, can you tell me exactly what specific 4.8 version?
Right now we are tracking this problem for VS Mac on Developer Community - which @knocte you commented already. Although the error reported here is for .NET Core 3.0 preview 3, and the callstack is slightly different from what is in this github issue, the underlying problem is the same.
There is also an issue filed against .NET Core - https://github.com/dotnet/core/issues/2460 - but it is a problem with Mono's MSBuild - not specific to .NET Core.
You may be able to workaround this by using a global.json file to downgrade the sdk used when building. Otherwise not installing the latest 2.1.602 sdk is another way to avoid this. Also I believe the latest mono 6.3 from master includes an updated MSBuild which should fix this.
I have the same problem related with "ResolvePackageDependencies" task failed unexpectedly on my Ubuntu machine.
Ubuntu 18.04
dotnet 2.2.202
Global json file doesn't help too.
My project works under 2.1 version and uninstalling 2.2.202 doesn't help me too.
As you say above you have solved this issue for Mac. Can you please do it for Ubuntu 18.04???
Same problem:
Microsoft.NET.Sdk.targets(129, 5): [MSB4018] The "GenerateDepsFile" task failed unexpectedly.
System.TypeLoadException: Could not load type of field 'Microsoft.NET.Build.Tasks.DependencyContextBuilder:_filteredPackages' (12) due to: Could not resolve type with token 01000027 from typeref (expected class 'NuGet.Packaging.Core.PackageIdentity' in assembly 'NuGet.Packaging, Version=5.0.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35') assembly:NuGet.Packaging, Version=5.0.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type:NuGet.Packaging.Core.PackageIdentity member:(null)
at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x00000] in <c5e0e1dbe29a4fae9ad829d4b52ccc8b>:0
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <57d75baabd164eb5a523fbc6e3599a2d>:0
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x001f6] in <57d75baabd164eb5a523fbc6e3599a2d>:0
OS:
[root@alpha-fedora bin]# cat /etc/fedora-release
Fedora release 29 (Twenty Nine)
NET Core SDK
[root@alpha-fedora bin]# dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.202
Commit: 8a7ff6789d
Runtime Environment:
OS Name: fedora
OS Version: 29
OS Platform: Linux
RID: fedora.29-x64
Base Path: /usr/share/dotnet/sdk/2.2.202/
Host (useful for support):
Version: 2.2.3
Commit: 6b8ad509b6
.NET Core SDKs installed:
2.1.602 [/usr/share/dotnet/sdk]
2.2.202 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Mono:
[root@alpha-fedora bin]# mono --version
Mono JIT compiler version 5.18.1.0 (tarball Fri Mar 15 15:48:09 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(600)
Suspend: preemptive
GC: sgen (concurrent by default)
(not repeated under Windows)
You may be able to workaround this by using a global.json file to downgrade the sdk used when building.
How does that global.json work? I thought that apt installations wouldn't depend on this? I for now am workarounding this problem by using an older version of .NETCore, yes, but downloading the .deb file manually.
A global.json can be used to specify a particular sdk version when building with msbuild.
A global.json can be used to specify a particular sdk version when building with msbuild.
Ah I see, however I'm not sure that would help me because I'm actually just installing .NET Core SDK as a workaround to this other bug: https://github.com/mono/mono/issues/10570
We have been having the same issue in Ubuntu 18.04 and 2.2 for a week now. Its a very crippling bug unless we downgrade to 105. any fix in sight?
This bug prevents from updating to latest dotnet sdk on ubuntu 16.04.
looking forward for a fix.
I hope this gets fixed soon. It's very annoying. The confusing version numbers where .NET SDK and .NET Core version numbers don't match doesn't help either... (https://developercommunity.visualstudio.com/content/problem/213229/the-current-net-sdk-does-not-support-targeting-net.html)
What eventually worked for me:
sudo apt install dotnet-sdk-2.2=2.2.105-1
sudo apt-mark hold dotnet-sdk-2.2
Since I also sometimes use Synaptic to update, I had to "Lock Version" there as well.
I also noticed this on Ubuntu 18.04 and msbuild 16 with .net core 2.2.300. I tried a few of the earlier versions of the dotnet-sdk, but had to drop down to 2.2.105.
Not sure if this helps.
Right now we are tracking this problem for VS Mac on Developer Community (https://developercommunity.visualstudio.com/content/problem/481018/resolvepackageassets-task-failed.html)
Matt, that issue in visualstudio.com has been marked as resolved, I guess because VS4Mac8.1 is out now in the stable channel, which has a fix for this. However, this covers only the part of the story when building from the IDE, not from the command line.
Also I believe the latest mono 6.3 from master includes an updated MSBuild which should fix this.
Any chance this fix could make into the 5.18 stable branch of mono? The stable channel in macOS is still on version 5.18.1.28 and I doubt an update to 6.3 will happen soon.
.NET Core 2.1.602 should be OK with Mono 5.18.1.28.
There is a matrix of supported VS Mac and .NET Core versions documented:
https://docs.microsoft.com/en-us/visualstudio/mac/net-core-support?view=vsmac-2019
I believe there is a plan to produce a some similar document, as shown above, but for Mono.
As of today the current VS Mac to Mono mappings are:
As far as I am aware there are no plans to make further MSBuild changes to Mono 5.18.1.
.NET Core 2.1.602 should be OK with Mono 5.18.1.28.
I just tested mono 5.20.1.19 (tarball Thu Apr 11 09:02:17 UTC 2019) with .NETCore 2.1.700 and still fails. Full build log here: https://gitlab.com/knocte/geewallet/-/jobs/232398170
Not sure what the status is of Mono 5.20 since it is on a different branch. Possibly MSBuild has not been updated on that branch. /cc @radical
Not seeing that error on the Mac. If you do something similar to the following what version do you get?
monodis --assembly /path/to/mono/msbuild/Current/bin/NuGet.Packaging.dll | grep Version
Also what does msbuild -version show?
Mono 5.18.1.28 uses NuGet 5.0 which should be OK with NuGet 5.1 in the .NET Core 2.1.700 SDK. MSBuild with Mono 5.18.1.28 is: 16.0.459+g5b35a69a2e for Mono
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018: System.TypeLoadException: Could not load type of field 'Microsoft.NET.Build.Tasks.DependencyContextBuilder:_filteredPackages' (12) due to: Could not resolve type with token 01000025 from typeref (expected class 'NuGet.Packaging.Core.PackageIdentity' in assembly 'NuGet.Packaging, Version=5.1.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35') assembly:NuGet.Packaging, Version=5.1.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Not sure what the status is of Mono 5.20
The stable channel of the apt repository is yielding this version.
Also what does msbuild -version show?
This:
Microsoft (R) Build Engine version 16.0.0.0 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
16.0.0.0
If you do something similar to the following what version do you get?
There are many files called this way, which one should I monodis?:
/usr/lib/mono/msbuild/15.0/bin/NuGet.Packaging.Core.dll
/usr/lib/mono/msbuild/15.0/bin/Sdks/Microsoft.NET.Sdk/tools/net46/NuGet.Packaging.Core.dll
/usr/lib/mono/msbuild/15.0/bin/Sdks/Microsoft.NET.Sdk/tools/net46/NuGet.Packaging.dll
/usr/lib/mono/msbuild/15.0/bin/NuGet.Packaging.dll
I ran monodis on NuGet.Packaging.dll. However I can see from that list of files that MSBuild is not up to date there. With Mono 5.18.1.28 there is no NuGet.Packaging.Core.dll. So I suspect NuGet 4.8 is being used.
Yes. Mono 5.20.1.19 seems to include NuGet 4.8:
$ monodis --assembly /usr/lib/mono/msbuild/15.0/bin/NuGet.Packaging.dll | grep Version
Version: 4.8.0.1
Yes. Mono 5.20.1.19 seems to include NuGet 4.8:
I confirm what @ermshiperete sees:
$ monodis --assembly /usr/lib/mono/msbuild/15.0/bin/NuGet.Packaging.Core.dll | grep Version
Version: 4.8.0.1
$ monodis --assembly /usr/lib/mono/msbuild/15.0/bin/Sdks/Microsoft.NET.Sdk/tools/net46/NuGet.Packaging.Core.dll | grep Version
Version: 4.7.0.5
$ monodis --assembly /usr/lib/mono/msbuild/15.0/bin/Sdks/Microsoft.NET.Sdk/tools/net46/NuGet.Packaging.dll | grep Version
Version: 4.7.0.5
$ monodis --assembly /usr/lib/mono/msbuild/15.0/bin/NuGet.Packaging.dll | grep Version
Version: 4.8.0.1
With Mono 5.18.1.28 there is no NuGet.Packaging.Core.dll
You mean in macOS? Because I'm guessing the scripts that were used to package mono 5.18 on the apt repository are the same ones that package the 5.20 version.
So I suspect NuGet 4.8 is being used.
There must be a difference somewhere around how mono is packaged on Linux vs macOS, for them to have different versions of nuget. I'm guessing we have to ping @directhex to help us fix this?
Just FTR, these are the versions on macOS:
$ monodis --assembly /Applications/Visual\ Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.PackageManagement/NuGet.Packaging.dll | grep Version
Version: 5.0.2.0
$ monodis --assembly /Library/Frameworks/Mono.framework/Versions/5.18.1/lib/mono/msbuild/Current/bin/NuGet.Packaging.dll | grep Version
Version: 5.0.2.0
$ monodis --assembly /Library/Frameworks/Mono.framework/Versions/5.18.1/lib/mono/msbuild/Current/bin/Sdks/Microsoft.NET.Sdk/tools/net472/NuGet.Packaging.dll | grep Version
Version: 5.0.0.5
$ monodis --assembly /usr/local/share/dotnet/sdk/2.1.700/NuGet.Packaging.dll | grep Version
Version: 5.1.0.5
Looking at the repo that I guess is used to build Linux packages it seems that the problem is fixed but the package not released yet:
$ monodis --assembly nuget-support/tasks-targets/NuGet.Packaging.dll | grep Version
Version: 5.0.0.5
It seems that the fixed package is currently in beta. @directhex any estimates when the fixed package version will be released?
It seems that the fixed package is currently in beta. @directhex any estimates when the fixed package version will be released?
If that nuget version is already released in the stable channel (not beta) for macOS, shouldn't Linux be in sync? Why is macOS's NuGet 5.x while Linux's is 4.x, but Linux's mono is 5.20.x while macOS's is 5.18.x? Food for thought :)
While by no means a proper fix, I have two work arounds in MonoDevelop 7.8.2 on Ubuntu 18 using dotnet core 2.2.300. Note that I will never be running a Mono project in this environment so I haven't tested that this doesn't break Mono:
1) I re-wrote the /usr/bin/msbuild command:
#!/bin/sh
DOTNET_DIR=/usr/share/dotnet/sdk/2.2.300
CMD="dotnet"
MSBUILD_CMD="$CMD $DOTNET_DIR/MSBuild.dll"
$MSBUILD_CMD $@
and secondly I overwrote the Mono Nuget* files with the files from my dotnet core sdk:
cd /usr/lib/mono/msbuild/15.0/bin/
sudo cp /usr/share/dotnet/sdk/2.2.300/NuGet* .
also experienced same error w/ubuntu and monodevelop. ironically it occurs on a net-standard project with no files or even nuget dependencies.
global json did not work. only thing worked was uninstall dotnet-sdk-3.1. oddly, running msbuild from the command line did succeed... but never monodevelop. these are using stable ubuntu packages.
HOST
$ cat /etc/lsb-release
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18.3
DISTRIB_CODENAME=sylvia
DISTRIB_DESCRIPTION="Linux Mint 18.3 Sylvia"
MONO
$ mono --version
Mono JIT compiler version 5.18.0.240 (tarball Wed Jan 16 09:13:03 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(600)
Suspend: preemptive
GC: sgen (concurrent by default)
MONODEVELOP
7.3.3
DOTNET ( when FAIL )
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.107
Commit: 2212cac826
Runtime Environment:
OS Name: linuxmint
OS Version: 18.3
OS Platform: Linux
RID: linuxmint.18.3-x64
Base Path: /usr/share/dotnet/sdk/2.2.107/
Host (useful for support):
Version: 3.1.0
Commit: 157910edee
.NET Core SDKs installed:
1.0.1 [/usr/share/dotnet/sdk]
2.2.107 [/usr/share/dotnet/sdk]
3.1.100 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
DOTNET (when WORKS OK):
.NET Core SDK (reflecting any global.json):
Version: 2.2.107
Commit: 2212cac826
Runtime Environment:
OS Name: linuxmint
OS Version: 18.3
OS Platform: Linux
RID: linuxmint.18.3-x64
Base Path: /usr/share/dotnet/sdk/2.2.107/
Host (useful for support):
Version: 3.1.0
Commit: 157910edee
.NET Core SDKs installed:
1.0.1 [/usr/share/dotnet/sdk]
2.2.107 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
DLLS
$ monodis --assembly /usr/lib/mono/msbuild/15.0/bin/NuGet.Packaging.Core.dll | grep Version
Version: 4.8.0.1
$ monodis --assembly /usr/lib/mono/msbuild/15.0/bin/Sdks/Microsoft.NET.Sdk/tools/net46/NuGet.Packaging.Core.dll | grep Version
Version: 4.7.0.5
$ monodis --assembly /usr/lib/mono/msbuild/15.0/bin/Sdks/Microsoft.NET.Sdk/tools/net46/NuGet.Packaging.dll | grep Version
Version: 4.7.0.5
$ monodis --assembly /usr/lib/mono/msbuild/15.0/bin/NuGet.Packaging.dll | grep Version
Version: 4.8.0.1
Also found this jetbrains article which is probably the most comprehensive discussion and suggested work-arounds when researching.
Hey all,
We believe that at this point this issue has been resolved on the xamarin/mono side.
Can you please confirm whether you are still having problems?
@knocte @mrward?
Closing per my last comment.
Most helpful comment
This bug prevents from updating to latest dotnet sdk on ubuntu 16.04.
looking forward for a fix.