Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget Packages are there but missing References

After branching in TFS, VS2015 Update 2 has missing references to all Nuget packages. Package restore says "All packages listed in packages.config are already installed."

I could manually add references to all of the packages in the \packages folder but why isn't VS already checking there?

like image 956
Shiloh Avatar asked Mar 14 '17 00:03

Shiloh


People also ask

Where are NuGet packages references stored?

Today, a project's NuGet package information is stored in a project-level packages. config folder. The assemblies are stored in a separate packages folder, usually at the solution level.

How do I restore references in Visual Studio?

Restore packages (In Visual Studio, the references appear in Solution Explorer under the Dependencies \ NuGet or the References node.) If the package references in your project file are correct, use your preferred tool to restore packages. If the package references in your project file (. csproj) or your packages.

How do I update NuGet package references?

Update a package. In Solution Explorer, right-click either References or the desired project, and select Manage NuGet Packages.... (In web site projects, right-click the Bin folder.) Select the Updates tab to see packages that have available updates from the selected package sources.


2 Answers

You need use the NuGet command line in the Package Manager Console:

Update-Package -reinstall 

to force reinstall the package references into project.

NuGet Restore only restores files in the packages directory (\packages folder ), but does not restore files inside your project or otherwise modify your project. For example, if a package has added some reference DLLs or other files in your project, if you delete any of these files, they will not be re-added when restoring this package. This may cause the your project to not be able to find the missing dependencies when building.

So use the "Update-Package -reinstall" command to force reinstall the package references and content files into project.

like image 178
Leo Liu-MSFT Avatar answered Oct 21 '22 14:10

Leo Liu-MSFT


This worked for me:

  • Unload proj from solution
  • Edit csproj file and delete nuggets entries from csproj file (ItemGroup).
  • Reload proj
like image 40
pabben Avatar answered Oct 21 '22 15:10

pabben