"Csc" 任务意外失败无法从程序集加载类型 System.ValueTuple 3 mscorlib Version=4.0.0.0,

The "Csc" task failed unexpectedly Could not load type System.ValueTuple 3 from assembly mscorlib Version=4.0.0.0,

在 MS Visual studio 2017 中构建项目时出现上述错误,我尝试还原 NuGet 包,而 visuals studio 显示此错误,请帮助解决

"The "Csc" task failed unexpectedly.
System.TypeLoadException: Could not load type 'System.ValueTuple`3' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at Microsoft.CodeAnalysis.BuildTasks.ManagedToolTask.GenerateCommandLineCommands()
   at Microsoft.Build.Utilities.ToolTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() AppModelv2-WebApp-OpenIDConnect-DotNet          
"

适用于 .NET 4.6.2 或更低版本

您需要安装 NuGet 包 System.ValueTuple。

Install-Package "System.ValueTuple"

如果这不起作用,请执行以下步骤。

1.Locate 你项目的包文件夹

2.Delete文件夹

3.Rebuild 你的项目