Asp.net-Core

Visual Studio 2017 - 無法載入文件或程序集“System.IO.FileSystem”

  • November 2, 2020

我剛剛將我的 Visual Studio 升級到了最新版本(2017 年 1 月 30 日)。我的 ASP.NET Core 項目在升級之前正在執行,但我現在收到以下錯誤,讓我停下來。有什麼簡單的解決方案嗎?

Severity    Code    Description Project File    Line    Suppression State
Error   MSB4018 The "ResolvePackageDependencies" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
  at Microsoft.NET.Build.Tasks.LockFileCache.LoadLockFile(String path)
  at Microsoft.NET.Build.Tasks.LockFileCache.GetLockFile(String path)
  at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.get_LockFile()
  at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.ReadProjectFileDependencies()
  at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.ExecuteCore()
  at Microsoft.NET.Build.Tasks.TaskBase.Execute()
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
  at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

在我的特殊情況下,我做了一個乾淨的解決方案,工具/選項/NuGet 包管理器/清除所有 NuGet 記憶體,然後重新啟動。載入/建構項目然後工作。

不確定這是多麼可重複。我很確定我的項目在我第一次載入它時工作,然後失敗,然後在這些步驟之後再次工作。它已在 2 台電腦上執行。

我通過dotnet build在 VS Studio 的 Paket-Manager 控制台中執行解決了這個問題。

軟體再次可調試後

引用自:https://stackoverflow.com/questions/41979136