"GenerateDepsFile"任务意外失败

问题描述:

我试图在MonoDevelop中编译我的新应用程序,但出现此错误:

I tried to compile my new application in MonoDevelop and I got this error:

/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(5,5):错误MSB4018:"GenerateDepsFile"任务意外失败. System.TypeLoadException:无法加载字段类型'Microsoft.NET.Build.Tasks.DependencyContextBuilder:_filteredPackages' (12)由于:无法解析来自typeref的令牌01000027的类型 (程序集中的预期类"NuGet.Packaging.Core.PackageIdentity" 'NuGet.Packaging,版本= 5.0.0.6,文化=中性, PublicKeyToken = 31bf3856ad364e35')程序集:NuGet.Packaging, 版本= 5.0.0.6,文化=中性,PublicKeyToken = 31bf3856ad364e35 类型:NuGet.Packaging.Core.PackageIdentity成员:(null) 在Microsoft.NET.Build.Tasks.TaskBase.Execute()[0x00000]中:: 0 在Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute ()[0x00029]在< 58f0218f988743a48dd7c84cbe933f4e>:0 在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存储桶, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask)[0x001f6] 在< 58f0218f988743a48dd7c84cbe933f4e>:0(MSB4018)(密码夹)

/usr/share/dotnet/sdk/2.2.203/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(5,5): Error 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 :0 at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <58f0218f988743a48dd7c84cbe933f4e>: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 <58f0218f988743a48dd7c84cbe933f4e>:0 (MSB4018) (passcracker)

我无法编译任何应用程序.请帮忙.

I cannot compile any application. Please help.

我在使用 .Net Standard 2.1 时遇到了同样的问题,我通过清理为自己解决了此问题解决方案,然后重建.

I had the same problem using .Net Standard 2.1, and I solved it for myself by cleaning the solution and then rebuilding it.