10

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.

Atri Banerjee
  • 119
  • 1
  • 1
  • 6

5 Answers5

52

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.

AxelWass
  • 1,321
  • 12
  • 21
2

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.

Urs Marian
  • 1,752
  • 1
  • 10
  • 3
1

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.

Bubba
  • 275
  • 1
  • 10
  • 24
    the reset button is not appearing in the console (VS-2015) and the check box is already checked, so this was not fruitful for me. Anyway thanks. – Atri Banerjee Dec 29 '15 at 18:41
1

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

Sasha Bond
  • 984
  • 10
  • 13
0

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.

Marlon Dias
  • 811
  • 9
  • 15