简体   繁体   中英

Unable to load Visual Studio 2015 project after adding dependency on Microsoft.Net.Compilers

My project has a dependency on the NuGet package Microsoft.Net.Compilers :

<package id="Microsoft.Net.Compilers" version="1.3.2" 
         targetFramework="net461" developmentDependency="true" />

However, if I'm loading Visual Studio after having cleared my packages folder my projects won't load with the following error:

The imported project "C:\\MyService\\packages\\Microsoft.Net.Compilers.1.3.2\\tools\\Microsoft.CSharp.Core.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
C:\\Program Files (x86)\\MSBuild\\14.0\\bin\\Microsoft.CSharp.CurrentVersion.targets

So it won't load the project because it's missing a file which is restored on build using Nuget, which only works if I can load the project.

You can use the Nuget commandline tool to restore your packages. If your system doesn't yet have it, you can find it here: https://www.nuget.org/

Issue this on the commandline:

nuget restore

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM