twitter-bootstrap Nuget 外部包不能依赖于面向项目的包

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19736595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 19:04:05  来源:igfitidea点击:

Nuget External packages cannot depend on packages that target projects

asp.net-mvc-4twitter-bootstrapnuget

提问by Peter

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

当我尝试在一个空的 mvc4 web 项目中安装包 Twitter.Bootstrap 我得到这个

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 ?

我能做些什么来解决这个问题?

回答by Adrian

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."

“从 v3.0.1.1 开始,Twitter.Boostrap 包将开始将用户重定向到由 Outercurve 基金会管理的 Bootstrap 包。这一举措的原因很简单。Bootstrap 是一个更干净的命名空间,因为该项目删除了一些 twitter 名称发布之前,Bootstrap 现在正式随 Visual Studio 2013 ASP.Net 模板一起提供。因此,为了避免混淆哪个版本是“官方”版本,我们同意将所有人重定向到新的 Microsoft 维护的命名空间。

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

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

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

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

回答by user2948567

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.

我在 VS 2010 和 VS 2012 中都遇到了同样的错误。建议的解决方案没有解决问题,但我确实注意到用于 Bootstrap 的 NuGet 包的日期是 2013 年 11 月 1 日(昨天)。新包的版本号为 3.0.1.1,它列出了 Bootstrap 版本 3.0.1 或更高版本的依赖项。此包的 3.0.1.1 版似乎存在错误,依赖项中存在循环引用。寻找相同作者的 3.0.1 版。

回答by Shuaib

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

我假设您使用的是 Visual Studio 2012。在 VS2012 中,新的 MVC4 项目默认加载了 jquery 1.7。但是 Bootstrap 3.0.1 依赖于 jquery 1.9 或更高版本

So first run

所以第一次运行

update-package jQuery

and then

接着

install-package twitter.bootstrap

回答by lyords

I had the same problem. After I updated NuGet Manager, it solved by problem. To update NuGet Manager, you can to Tools -> Extensions and Updates

我有同样的问题。更新 NuGet 管理器后,问题解决了。要更新 NuGet 管理器,您可以在 Tools -> Extensions and Updates

回答by Yini

I had the same problem when installing Bootstrap 3.0.1.1. It does look like it is looking for 3.0.1 for its dependency. I at the end installed 3.0.0 with no problem.

安装 Bootstrap 3.0.1.1 时我遇到了同样的问题。它看起来像是在寻找 3.0.1 的依赖项。我最后安装了 3.0.0 没有问题。

回答by carey walker

I had this same problem that brought me to this question. In Package Manager I searched for bootstrap and there were several results returned.

我遇到了同样的问题,让我想到了这个问题。在包管理器中,我搜索了 bootstrap 并返回了几个结果。

I clicked on the on at the top of the list and tried to install this one (version 3.0.1.1) and received the error reported in the original question. The ID of this package is Id: Twitter.Bootstrap

我单击列表顶部的 on 并尝试安装这个(版本 3.0.1.1)并收到原始问题中报告的错误。这个包的ID是Id:Twitter.Bootstrap

There was another Bootstrap package listed with version 3.0.2 with Id: bootstrap

3.0.2 版列出了另一个 Bootstrap 包,ID:bootstrap

I installed the second one v. 3.0.2 and this installed without any issues.

我安装了第二个 v. 3.0.2,安装没有任何问题。

Taken from fontawesome: "The folks at Outercurve have taken over support for the Twitter.Bootstrap package now being called simply bootstrap. More info here http://chriskirby.net/bootstrap-nuget-package-moving-to-outercurve/"

摘自 fontawesome:“Outercurve 的人们已经接管了对 Twitter.Bootstrap 包的支持,现在被称为简单的引导程序。更多信息在这里http://chriskirby.net/bootstrap-nuget-package-moving-to-outercurve/

It would seem to me that the redirect to the new Microsoft maintained namespace is causing this to happen.

在我看来,重定向到新的 Microsoft 维护的命名空间导致了这种情况的发生。

回答by SOS

My Problem perfectly solved

我的问题完美解决

Try

尝试

Install-Package Bootstrap

Instead of

代替

Install-Package Twitter.Bootstrap

refered post:

参考帖子:

Bootstrap v3.0.1.1 fails on clean VS empty project - how to resolve?$privUrl

Bootstrap v3.0.1.1 在干净的 VS 空项目上失败 - 如何解决?$privUrl

how to launch Package Manager console

如何启动包管理器控制台

http://docs.nuget.org/docs/start-here/using-the-package-manager-console

http://docs.nuget.org/docs/start-here/using-the-package-manager-console

回答by Edward

I updated VS2012 to VS2013. It resolved the problem

我将 VS2012 更新为 VS2013。它解决了问题

回答by Nguy?n Duy H?o

Just try update vs2012 !I resolved it!

试试更新vs2012!我解决了!

回答by Pankaj Dubey

just try installing Twitter bootstrap MVCwith NuGet Package Manager and enjoy

只需尝试使用 NuGet 包管理器安装Twitter bootstrap MVC并享受