简体   繁体   中英

Getting Nuget Package missing error

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.

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.

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.

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.

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

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.

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