简体   繁体   English

无法将NuGet软件包安装到项目中

[英]cannot install NuGet package into project

I cannot install the NuGet package System.IdentityModel.Tokens.Jwt (.Net JWT Handler) into my project. 我无法将NuGet包System.IdentityModel.Tokens.Jwt(.Net JWT Handler)安装到我的项目中。 If i try to install the package with NuGet, it will install into the root of the solution only (a .nuget folder is created in the root of the solution). 如果我尝试使用NuGet安装软件包,它将仅安装到解决方案的根目录中(在解决方案的根目录中创建了.nuget文件夹)。 I need to install the package in my project, not the solution. 我需要在项目中安装软件包,而不是解决方案。

Why would this happen? 为什么会这样? I tried passing in the project name to the Install-Package command in the Package Manager Console, and that looks like it installs correctly but no references are added to my project and the packages.config file is not updated. 我尝试将项目名称传递给Package Manager控制台中的Install-Package命令,看起来它可以正确安装,但是没有引用添加到我的项目中,并且package.config文件没有更新。

My project is currently referencing .Net 4.5.1 and I have also tried with .Net 4.5. 我的项目当前引用的是.Net 4.5.1,我也尝试使用.Net 4.5。

The package I am trying to install is here: 我要安装的软件包在这里:
System.IdentityModel.Tokens.Jwt System.IdentityModel.Tokens.Jwt

I'm having the same issue. 我有同样的问题。 I was trying to install the package as said in this article http://msdn.microsoft.com/en-us/library/dn205064(v=vs.110).aspx So, I look into the package history and finally I installed the previous package http://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/3.0.0 我试图按照本文http://msdn.microsoft.com/zh-cn/library/dn205064(v=vs.110).aspx的说明安装程序包,因此,我仔细研究了程序包的历史,最后安装了程序包先前的软件包http://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/3.0.0

It works fine for me. 这对我来说可以。

With NuGet, you can now specify the directory the packages are installed in. 使用NuGet,您现在可以指定软件包安装的目录。

http://docs.nuget.org/docs/release-notes/nuget-2.1 http://docs.nuget.org/docs/release-notes/nuget-2.1

Specify 'packages' Folder Location 指定“程序包”文件夹位置

In the past, NuGet has managed a solution's packages from a known 'packages' folder found beneath the solution root directory. 过去,NuGet从解决方案根目录下的已知“ packages”文件夹管理解决方案的软件包。 For development teams that have many different solutions which have NuGet packages installed, this can result in the same package being installed in many different places on the file system. 对于具有许多不同解决方案且已安装NuGet软件包的开发团队,这可能导致同一软件包安装在文件系统上的许多不同位置。 NuGet 2.1 provides more granular control over the location of the packages folder via the 'repositoryPath' element in the NuGet.config file. NuGet 2.1通过NuGet.config文件中的'repositoryPath'元素提供了对packages文件夹位置的更精细控制。 Building on the previous example of hierarchical nuget.config support, assume that we wish to have all projects under C:\\myteam\\ share the same packages folder. 在先前的分层nuget.config支持示例的基础上,假设我们希望C:\\ myteam \\下的所有项目共享相同的packages文件夹。 To accomplish this, simply add the following entry to C:\\myteam\\nuget.config. 为此,只需将以下条目添加到C:\\ myteam \\ nuget.config。

The package System.IdentityModel.Tokens.Jwt 3.0.1 has some problems: the file System.IdentityModel.Tokens.Jwt.dll and System.IdentityModel.Tokens.Jwt.Xml should be put in directory lib\\net45 , but they are put in the root directory instead. 软件包System.IdentityModel.Tokens.Jwt 3.0.1有一些问题:文件System.IdentityModel.Tokens.Jwt.dllSystem.IdentityModel.Tokens.Jwt.Xml应该放在目录lib\\net45 ,但是要把它们放在目录中在根目录中。 This causes NuGet to think the package is a solution level package, and will not install the package into a project. 这会使NuGet认为该软件包是解决方案级别的软件包,并且不会将该软件包安装到项目中。

This problem was fixed in System.IdentityModel.Tokens.Jwt 3.0.2 此问题已在System.IdentityModel.Tokens.Jwt 3.0.2中修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM