1

This is a simple error, but frustrating? My project won't rebuild/compile. The error is:

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.2.1\build\Microsoft.Net.Compilers.props. Microsoft.Bot.Sample.LuisBot    C:\Users\jmatson\Downloads\retail-info-bot-src\Microsoft.Bot.Sample.LuisBot.csproj  229 

So I try a nuget restore and get:

All packages are already installed and there is nothing to restore. Time Elapsed: 00:00:00.0455939
========== Finished ==========

So who is right, who is wrong, and how is this fixed? :/

JamesMatson
  • 2,522
  • 2
  • 37
  • 86
  • Check the packages folder and see if that subfolder mentioned in the error exists. If it does, delete it and then try to restore again. This has happened to me before where restore didn't work because the folder+nupkg file were present (but nothing else was). Does that fix it for you? – pinkfloydx33 Aug 26 '18 at 05:31
  • update the Microsoft.Net.Compilers package to last version 2.9 and look if this works. – magicandre1981 Aug 26 '18 at 05:32
  • If all this does not work check if you folders have %20 (space) in them. Nuget package does not like this.. – Aldert Aug 26 '18 at 06:40

1 Answers1

0

Visual Studio compile error - nuget package missing from computer, but nuget restore says all packages installed?

First, make sure you are not add the \packages folder into the source control. If you added it, remove it from source control.

Second, if you are not using source control or not add that folder into the source control, but still have this issue, you should delete the package Microsoft.Net.Compilers.1.2.1 in the \packages folder, then use the NuGet command line in the Package Manager Console:

Update-Package -reinstall

to force reinstall the package references into project.

The file Microsoft.Net.Compilers.props location change or the file missing in the packages folder will cause this issue. In other words, the file Microsoft.Net.Compilers.props is missing the packages folder but the package is there, you will get the that error.

Check the similar issue here.

Hope this helps.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135