question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MSB4018: The "GenerateDepsFile" task failed unexpectedly.

See original GitHub issue

I am trying to use Ubuntu 18.04 to test some things, and I can use any of the newer .NET Core SDKs.

I just installed a fresh VM with 18.04, and installed my usual tools. I then try and build SkiaSharp, and then the .NET Standard projects and Tizen fail to build with the same error.

I can roll back to dotnet-sdk-2.1.105, and that seems to work fine. As soon as I go later, then it fails. I tried installing a different version of dotnet 2.2, but I only have one for some reason. Sure, I could install it manually and all that. But, who wants to do that - and I am not even sure it is going to work.

Here is my apt-search output: https://gist.github.com/mattleibow/935de7d22b24cfcf3ae9ab0c16b1908f

What is the reason for these failures? My code was working - as it is building just fine with 2.1.105, and then I bump up just a fraction and boom?

Build Errors:

/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. [/media/matthew/Projects/SkiaSharp/binding/SkiaSharp.NetStandard/SkiaSharp.NetStandard.csproj]
/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 type:NuGet.Packaging.Core.PackageIdentity member:(null) [/media/matthew/Projects/SkiaSharp/binding/SkiaSharp.NetStandard/SkiaSharp.NetStandard.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x00000] in <a7945d89c0ac41f8a1c76203a2991e34>:0  [/media/matthew/Projects/SkiaSharp/binding/SkiaSharp.NetStandard/SkiaSharp.NetStandard.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <58f0218f988743a48dd7c84cbe933f4e>:0  [/media/matthew/Projects/SkiaSharp/binding/SkiaSharp.NetStandard/SkiaSharp.NetStandard.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   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 <58f0218f988743a48dd7c84cbe933f4e>:0  [/media/matthew/Projects/SkiaSharp/binding/SkiaSharp.NetStandard/SkiaSharp.NetStandard.csproj]
/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. [/media/matthew/Projects/SkiaSharp/binding/HarfBuzzSharp.NetStandard/HarfBuzzSharp.NetStandard.csproj]
/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 type:NuGet.Packaging.Core.PackageIdentity member:(null) [/media/matthew/Projects/SkiaSharp/binding/HarfBuzzSharp.NetStandard/HarfBuzzSharp.NetStandard.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x00000] in <a7945d89c0ac41f8a1c76203a2991e34>:0  [/media/matthew/Projects/SkiaSharp/binding/HarfBuzzSharp.NetStandard/HarfBuzzSharp.NetStandard.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <58f0218f988743a48dd7c84cbe933f4e>:0  [/media/matthew/Projects/SkiaSharp/binding/HarfBuzzSharp.NetStandard/HarfBuzzSharp.NetStandard.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   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 <58f0218f988743a48dd7c84cbe933f4e>:0  [/media/matthew/Projects/SkiaSharp/binding/HarfBuzzSharp.NetStandard/HarfBuzzSharp.NetStandard.csproj]

...

/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. [/media/matthew/Projects/SkiaSharp/binding/SkiaSharp.Tizen/SkiaSharp.Tizen.csproj]
/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 type:NuGet.Packaging.Core.PackageIdentity member:(null) [/media/matthew/Projects/SkiaSharp/binding/SkiaSharp.Tizen/SkiaSharp.Tizen.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x00000] in <a7945d89c0ac41f8a1c76203a2991e34>:0  [/media/matthew/Projects/SkiaSharp/binding/SkiaSharp.Tizen/SkiaSharp.Tizen.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <58f0218f988743a48dd7c84cbe933f4e>:0  [/media/matthew/Projects/SkiaSharp/binding/SkiaSharp.Tizen/SkiaSharp.Tizen.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   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 <58f0218f988743a48dd7c84cbe933f4e>:0  [/media/matthew/Projects/SkiaSharp/binding/SkiaSharp.Tizen/SkiaSharp.Tizen.csproj]
/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. [/media/matthew/Projects/SkiaSharp/binding/HarfBuzzSharp.Tizen/HarfBuzzSharp.Tizen.csproj]
/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 type:NuGet.Packaging.Core.PackageIdentity member:(null) [/media/matthew/Projects/SkiaSharp/binding/HarfBuzzSharp.Tizen/HarfBuzzSharp.Tizen.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x00000] in <a7945d89c0ac41f8a1c76203a2991e34>:0  [/media/matthew/Projects/SkiaSharp/binding/HarfBuzzSharp.Tizen/HarfBuzzSharp.Tizen.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <58f0218f988743a48dd7c84cbe933f4e>:0  [/media/matthew/Projects/SkiaSharp/binding/HarfBuzzSharp.Tizen/HarfBuzzSharp.Tizen.csproj]
/usr/share/dotnet/sdk/2.1.700/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:   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 <58f0218f988743a48dd7c84cbe933f4e>:0  [/media/matthew/Projects/SkiaSharp/binding/HarfBuzzSharp.Tizen/HarfBuzzSharp.Tizen.csproj]

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
livarcocccommented, Jun 30, 2019

Do you have environment variable MSBuildSDKsPath or MSBuildExtensionsPath set by any change? It seems like it is possible that your 2.2.300 SDK is loading 2.1.700 props/targets, as show above. This usually happens when folks set the PATH to the SDK manually using the environment variables above.

1reaction
AndreyAkinshincommented, Jul 10, 2019

@mattleibow if you are using Mono MSBuild, then you probably have incompatible versions of Mono MSBuild and .NET Core SDK. The problem and possible solutions are described here: https://rider-support.jetbrains.com/hc/en-us/articles/360004180039

Read more comments on GitHub >

github_iconTop Results From Across the Web

The "GenerateDepsFile" task failed unexpectedly
Just moved my projects to a new machine (copying, not pulling from GIT) and started getting this. Deleting the bin and obj folders...
Read more >
The "GenerateDepsFile" task failed unexpectedly. I ...
Severity Code Description Project File Line Suppression State Error MSB4018 The "GenerateDepsFile" task failed unexpectedly. System.IO.
Read more >
The "GenerateDepsFile" task failed unexpectedly.
Error MSB4018 The "GenerateDepsFile" task failed unexpectedly. System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
Read more >
The " GenerateDepsFile" Task failed unexpectedly #26315
Error MSB4018 The "GenerateDepsFile" task failed unexpectedly. System.ArgumentException: An item with the same key has already been added.
Read more >
Error MSB4018: the “generatedepsfile” task failed ...
I recently ran into a compilation error that is preventing me from building and running my WebAPI. It was working perfectly just the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found