Core: Build Error VS2019 for Mac Preview 3 'The "ResolvePackageAssets" task failed unexpectedly.'

Created on 15 Mar 2019  路  14Comments  路  Source: dotnet/core

Issue Build Error VS2019 for Mac Preview 3 'The "ResolvePackageAssets" task failed unexpectedly.'

General

.NET Core SDK Version: 3.0.100-preview3-010431
IDE: Visual Studio 2019 for Mac (Preview 3)

After installing .NET Core 3.0 sdk I am no longer able to build my WebAPI project through Visual Studio. It seems to build fine using "dotnet build" with CLI. Prior to installing and updating the WebAPI project to ASP.NET Core 3.0 (Preview 3), I didn't have any issues building through Visual Studio. If I can provide anymore helpful information, please just let me know. Below is the description of the error I am receiving.

/usr/local/share/dotnet/sdk/3.0.100-preview3-010431/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(5,5): Error MSB4018: The "ResolvePackageAssets" task failed unexpectedly.
System.TypeLoadException: Could not resolve type with token 0100003f from typeref (expected class 'NuGet.Packaging.Core.PackageDependency' in assembly 'NuGet.Packaging, Version=5.0.0.4, Culture=neutral, PublicKeyToken=31bf3856ad364e35')
at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheWriter.GetPlatformPackageExclusions () [0x000d7] in <9524e6fbf1724027a475d15b01fab866>:0
at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheWriter..ctor (Microsoft.NET.Build.Tasks.ResolvePackageAssets task, System.IO.Stream stream) [0x0009b] in <9524e6fbf1724027a475d15b01fab866>:0
at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheReader.CreateReaderFromDisk (Microsoft.NET.Build.Tasks.ResolvePackageAssets task, System.Byte[] settingsHash) [0x0003a] in <9524e6fbf1724027a475d15b01fab866>:0
at Microsoft.NET.Build.Tasks.ResolvePackageAssets+CacheReader..ctor (Microsoft.NET.Build.Tasks.ResolvePackageAssets task) [0x00015] in <9524e6fbf1724027a475d15b01fab866>:0
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups () [0x00000] in <9524e6fbf1724027a475d15b01fab866>:0
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore () [0x00018] in <9524e6fbf1724027a475d15b01fab866>:0
at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x00000] in <9524e6fbf1724027a475d15b01fab866>:0
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:573
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) [0x00212] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:784

All 14 comments

Same

Same thing here, but also for VS 2017 targeting ASP.NET Core 2.2, not only for 3.0 preview. My previous projects don't work anymore in VS after installing .NET Core 3.0 preview. Very annoying.

@ovicrisan - you need to use the VS 2019 Previews in order to work with .NET Core 3.0 Previews. 3.0 will not be supported from VS 2017.

I wasn't explicit enough: beside VS 2019 not working after installing .NET Core 3.0 preview 3, also my previous (side-by-side) VS 2017 targeting .NET Core 2.2 doesn't work any more.
Building and running it from CLI works fine, but not from VS. This is from VS 2017 w/ .NET Core 2.2 project:

Screen Shot 2019-03-18 at 11 00 45 PM

I've just uninstalled .NET 3.0 preview3 as described here https://docs.microsoft.com/en-us/dotnet/core/versions/remove-runtime-sdk-versions?tabs=macos and everything works fine now:

$ dotnet --list-sdks
[...]
3.0.100-preview3-010431 /usr/local/share/dotnet/sdk
$ sudo rm -rf /usr/local/share/dotnet/sdk/3.0.100-preview3-010431

$ dotnet --list-runtimes
[...]
Microsoft.AspNetCore.App 3.0.0-preview3-19153-02 /usr/local/share/dotnet/shared/Microsoft.AspNetCore.App
Microsoft.NETCore.App 3.0.0-preview3-27503-5 /usr/local/share/dotnet/shared/Microsoft.NETCore.App

$ sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.AspNetCore.App/Microsoft.AspNetCore.App 3.0.0-preview3-19153-02
$ sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.AspNetCore.App/Microsoft.NETCore.App 3.0.0-preview3-27503-5

Is there still a problem to resolve in VS 2019 for Mac? Or does the last reply mean there is a way to resolve it?
cc @mhutch

I'm experiencing the same issue. Unless you completely remove the core 3.0 preview SDK, all .NET core projects stop building on either version of VS for Mac.

I'm no longer receiving the same error that I started this issue with. I'm now seeing the error below when I try to build.
Error: The version of the .NET Core SDK currently installed (/usr/local/share/dotnet/sdk/3.0.100-preview3-010431/Sdks) is not supported and continuing to use it may result in a broken tooling experience.

@JordanPritt any idea why is your experience different from @aaronmbos ?

@karelz I鈥檓 not certain what you鈥檙e asking. Could you elaborate please? Thanks

@JordanPritt it is unclear if there is anything left to address and if everyone is seeing the same problems.

Duplicate of #2460

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mmacneil picture mmacneil  路  3Comments

zuosc picture zuosc  路  3Comments

ugurcemozturk picture ugurcemozturk  路  3Comments

swapnild2111 picture swapnild2111  路  3Comments

ffes picture ffes  路  3Comments