Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 - Could not load file or assembly 'System.IO.FileSystem

I just upgraded my Visual Studio to the latest version (1/30/2017). My ASP.NET Core project was working before the upgrade, but I now get the following error that stops me. Are there any simple solutions to this?

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()
like image 326
L. Piotrowski Avatar asked Feb 01 '17 11:02

L. Piotrowski


1 Answers

In my particular case, I did a Clean Solution, Tools/options/NuGet Package Manager/Clear All NuGet Cache(s), then a reboot. Loading/building the project then worked.

Not sure how repeatable this is. I'm quite sure my project worked the first time I loaded it, then failed, then worked again after these steps. It has worked on 2 computers.

like image 173
CraigP Avatar answered Sep 18 '22 06:09

CraigP