Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget "already has a reference to"

Tests.Functional is selected from the Default project: drop down.

PM> install-package nunit
'NUnit 2.6.0.12054' already installed.
Tests.Functional already has a reference to 'NUnit 2.6.0.12054'.

Yet Nunit does not show up in References for Tests.Functional in the Solution Explorer. Tried reloading VS.Net (2010) and updating Nuget.

Am I missing something?

like image 309
mxmissile Avatar asked May 01 '12 15:05

mxmissile


2 Answers

When running the solution under TFS, make sure the $(SolutionDir)\Packages\repositories.config file is checked out for edit.

Try the following:

Uninstall-Package NUnit -Force

Verify the Tests.Functional.csproj file (using notepad) no longer has any Reference to NUnit (if it still does, manually delete them, the project file probably got corrupted somehow).

Then run the following commandl:

Install-Package NUnit
like image 125
Xavier Decoster Avatar answered Nov 18 '22 17:11

Xavier Decoster


I ran in to a similar issue trying to download the xunit framework when looking at the Entity Framework code. I worked around this by selecting a project to install to xunit to that didn't have the reference already, then just went in to manage and removed the reference to the project that didn't actually need it.

It appears that when a project references an assembly it doesn't have, nuget will see the reference and think that it doesn't need the assembly, even though it does. Simply adding the assembly to another project through nuget solves the issue. Not the most elegant solution, but it works.

like image 1
Zipper Avatar answered Nov 18 '22 15:11

Zipper