Nic
Nic

Reputation: 12846

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.

Upvotes: 3

Views: 3408

Answers (1)

jessehouwing
jessehouwing

Reputation: 114461

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

Upvotes: 7

Related Questions