Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget package installed but references not resolved

I have a multi-project solution with Prism Nuget packages installed in several projects. I then attempted to add a Prism Mef extensions package to one of the projects using the Nuget Package Manager UI (I have already added it to one of the other projects).

The first time I attempted to add the package, it failed to install one of the dependencies, no specific error reason, just "failed". So, I installed it a second time, all seemed to be fine, no errors reported, but a few of the references did not resolve.

So, I uninstalled the package and all dependencies and installed it again. Again all appeared fine, but more references do not resolve.

I have tried uninstalling and installing the package more times but get the same result every time now.

I have had this problem many times and I know its not specific to the Prism package as I've had it with loads of different packages.

I think its just a major bug with Nuget, but I'm hoping somebody will know an easy way to fix it. I think I usually have better success with the Nuget console, but I find it more effort to use.

I've done some searching online and not really found a good explanation of the cause of the problem or a way to resolve it.

Somebody at work completely refuses to have anything to do with Nuget as he has so many of these issues, but I am determined to make it work!

like image 735
Glen Thomas Avatar asked Jul 27 '15 21:07

Glen Thomas


People also ask

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.

How do I reference a NuGet package?

You can use #r to reference a NuGet package directly like so: #r "nuget: PackageName" . Here is a fuller example using the Farmer library for declaratively deploying Azure resources. Note: if you're writing a script for re-use, it's better to explicitly include a version number.

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.


2 Answers

Within the Package Manager Console run the following command:

Update-Package -reinstall 

This will reinstall each nuget package within that project which should resolve any missing references.

If you know you're missing a specific reference:

Update-Package -reinstall <Package-Name> 
like image 74
CAOakley Avatar answered Sep 17 '22 13:09

CAOakley


I just closed Visual Studio and reopened it and references are resolved...!

like image 32
Glen Thomas Avatar answered Sep 16 '22 13:09

Glen Thomas