Skip to content

Getting "GenerateDepsFile" task failed unexpectedly with KeyNotFoundException when publishing project #3159

@nguyenquyhy

Description

@nguyenquyhy

I am getting "GenerateDepsFile" task failed unexpectedly with KeyNotFoundException when publishing my projects.

Below are the conditions that trigger the issue:

  • .NET Core 3.0 Preview 4
  • WindowsAzure.Storage 9.3.3 is in a .NET Standard library

This can be fixed by either going back to Preview 3 or add WindowsAzure.Storage directly into the .NET Core project.

Error in build log:

C:\Program Files\dotnet\sdk\3.0.100-preview4-011223\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(801,5): Error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Microsoft.NET.Build.Tasks.DependencyContextBuilder2.CalculateExcludedLibraries() in /_/src/Tasks/Microsoft.NET.Build.Tasks/DependencyContextBuilder2.cs:line 769
   at Microsoft.NET.Build.Tasks.DependencyContextBuilder2.Build() in /_/src/Tasks/Microsoft.NET.Build.Tasks/DependencyContextBuilder2.cs:line 215
   at Microsoft.NET.Build.Tasks.GenerateDepsFile.WriteDepsFileNew(String depsFilePath) in /_/src/Tasks/Microsoft.NET.Build.Tasks/GenerateDepsFile.cs:line 248
   at Microsoft.NET.Build.Tasks.GenerateDepsFile.ExecuteCore() in /_/src/Tasks/Microsoft.NET.Build.Tasks/GenerateDepsFile.cs:line 284
   at Microsoft.NET.Build.Tasks.TaskBase.Execute() in /_/src/Tasks/Common/TaskBase.cs:line 35
   at Microsoft.NET.Build.Tasks.GenerateDepsFile.Execute() in /_/src/Tasks/Microsoft.NET.Build.Tasks/GenerateDepsFile.cs:line 262
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

Sample repository: https://github.com/nguyenquyhy/IssueWindowsAzureStoragePublish

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions