arame3333
arame3333

Reputation: 10193

The imported project "C:\Program Files\dotnet\sdk\2.1.201\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found

In Visual Studio 2017, I go to the Package Manager to do a dotnet restore. Then I get an error message

error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.201\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found.

I navigate to

C:\Program Files\dotnet\sdk\2.1.201\Microsoft

and the VisualStudio path is missing and hence the error message. How do I fix this?

Upvotes: 13

Views: 20291

Answers (1)

Vivelin
Vivelin

Reputation: 787

If you have a mixed solution that contains both .NET Framework and .NET Core (web) projects, dotnet restore won't be able to build .NET Framework projects and will cause an error in newer versions of the .NET Core SDK, as detailed in NuGet/Home#6665.

If you are experiencing this error from the command line, but not from Visual Studio itself, you might have more luck building the full solution using MSBuild.

Upvotes: 17

Related Questions