10
votes

I am getting the following issue while compiling my project. It is a MVC 5 application. Here is the error:

Severity Code Description Project File Line Suppression State Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props. WikidoctorAdmin E:\My Projects\Wiki-Doctor\Wiki-Doctor.com\Wiki-Doctor.com\WikidoctorAdmin\WikidoctorAdmin.csproj 2107

Please help me how to solve this error.

5
Did you try doing what the error message suggests - using NuGet Package Restore?EkcenierK
read the error message?vidstige
@vidstige the error lies. Restore does nothing, in fact I've had this error with absolutely nothing even select-able in the restore option.RustyH

5 Answers

51
votes

I had the same issue and solve it by opening the project in a text editor and deleting the following section:

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
    <Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
</Target>

I didn't need Nuget for this project.

Hope this helps.

1
votes

You can fix this one of two ways:

Under Tools/Nuget Package Manager:

Menu screen capture

1) Choose the first option (Package manager Console).

  • Package manager console window will appear (Usually toward the bottom of the screen)
  • You should see a button that says "Restore Missing packages"...Click it.

This method will work for this project only...and you will have you redo this for each project with missing packages

2) Choose Package Manager settings

  • Make sure the check box that says "Allow Nuget to download missing packages" is checked
  • Re-build your solution

Nuget will automatically download missing packages from now on. This is easier, but might not always be what you want.

1
votes

The name of the project is longer than 248 characters. You need to rename the path under 248 characters, then open solution and rebuild and the nuget will be updated.

1
votes

that worked for me having similar error -
go to your complaining project references - find references with yellow marks open solution nuget package manager and 'reinstall' nuget packages which have those yellow marked dlls.

easy way to reinstall one by one - select nuget in the right, in the left upper portion there would be checked projects. in the left lower portion - select one version down, install, select one version up (your needed version), install - repeat for all questioned nugets

0
votes

I've got the same problem, and I solved this way: - erase every obj and bin folders under the solution projects, - using the NuGet Package manager to restore and update all packages. Hope it helps.