Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget External packages cannot depend on packages that target projects

When I attempt to Install-Package Twitter.Bootstrap in an empty mvc4 web project I get this

Install-Package Twitter.Bootstrap
Attempting to resolve dependency 'bootstrap (≥ 3.0.1)'.
Attempting to resolve dependency 'jquery (≥ 1.9.0)'.
Install-Package : External packages cannot depend on packages that target projects.
At line:1 char:1
+ Install-Package Twitter.Bootstrap
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

What can I do to fix this ?

like image 646
Peter Avatar asked Nov 01 '13 22:11

Peter


People also ask

Does NuGet install dependencies?

- [Instructor] Anytime a package is installed, NuGet also installs any additional package on which that first package depends. Installing these dependency packages happens on the original install or when reinstalled and also during a restore process.

What is NuGet dependency?

Any time a package is installed or reinstalled, which includes being installed as part of a restore process, NuGet also installs any additional packages on which that first package depends. Those immediate dependencies might then also have dependencies on their own, which can continue to an arbitrary depth.

How do I manage NuGet packages in Visual Studio?

To manage your package sources, select the Settings icon or select Tools > Options. In the Options window, expand the NuGet Package Manager node and select Package Sources. To add a source, select +, edit the Name, enter the URL or path in Source, and then select Update.


3 Answers

I had the same problem, this work for me:

Install-Package Bootstrap

"As of v3.0.1.1 the Twitter.Boostrap package will begin redirecting users to the Bootstrap package managed by the Outercurve foundation. The reason for this move is pretty simple. Bootstrap is a cleaner namespace since the project dropped the twitter name a few releases ago and Bootstrap now officially ships with the Visual Studio 2013 ASP.Net templates. So to avoid confusion on which release is "official", we've agreed to redirect everyone over to the new Microsoft maintained namespace."

http://chriskirby.net/bootstrap-nuget-package-moving-to-outercurve/

https://github.com/sirkirby/twitter-bootstrap-nuget/issues/22

like image 77
Adrian Avatar answered Nov 10 '22 03:11

Adrian


I encountered the same error with both VS 2010 and VS 2012. The suggested solution did not solve the problem, but I did notice that the NuGet Package for Bootstrap is dated Nov 1, 2013 (yesterday). The new package has version number 3.0.1.1 and it lists a dependency of Bootstrap version 3.0.1 or higher. It appears there is an error in version 3.0.1.1 of this package with a circular reference in the dependency. Look for version 3.0.1 by the same authors.

like image 23
user2948567 Avatar answered Nov 10 '22 02:11

user2948567


I am assuming you are using Visual Studio 2012. In VS2012 new MVC4 projects are loaded with jquery 1.7 by default. But Bootstrap 3.0.1 has a dependency on jquery 1.9 or higher

So first run

update-package jQuery

and then

install-package twitter.bootstrap
like image 34
Shuaib Avatar answered Nov 10 '22 01:11

Shuaib