无法将NuGet包安装到项目中

时间:2022-03-29 23:04:36

I cannot install the NuGet package System.IdentityModel.Tokens.Jwt (.Net JWT Handler) into my project. 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). I need to install the package in my project, not the solution.

我无法将NuGet包System.IdentityModel.Tokens.Jwt(.Net JWT Handler)安装到我的项目中。如果我尝试使用NuGet安装软件包,它将仅安装到解决方案的根目录中(在解决方案的根目录中创建.nuget文件夹)。我需要在我的项目中安装软件包,而不是解决方案。

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.

为什么会这样?我尝试将项目名称传递给程序包管理器控制台中的Install-Package命令,看起来它安装正确但没有引用添加到我的项目中,并且packages.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

3 个解决方案

#1


3  

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/en-us/library/dn205064(v=vs.110).aspx所以,我查看包历史,最后我安装上一个包http://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/3.0.0

It works fine for me.

这对我来说可以。

#2


0  

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

指定'packages'文件夹位置

In the past, NuGet has managed a solution’s packages from a known ‘packages’ folder found beneath the solution root directory. 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 2.1 provides more granular control over the location of the packages folder via the ‘repositoryPath’ element in the NuGet.config file. 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. To accomplish this, simply add the following entry to C:\myteam\nuget.config.

过去,NuGet已经从解决方案根目录下的已知“包”文件夹管理了解决方案的包。对于具有许多安装了NuGet软件包的不同解决方案的开发团队,这可能导致在文件系统上的许多不同位置安装相同的软件包。 NuGet 2.1通过NuGet.config文件中的'repositoryPath'元素提供了对packages文件夹位置的更精细控制。在前面的分层nuget.config支持示例的基础上,假设我们希望将所有项目都放在C:\ myteam \下共享相同的packages文件夹。要完成此操作,只需将以下条目添加到C:\ myteam \ nuget.config即可。

#3


0  

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. This causes NuGet to think the package is a solution level package, and will not install the package into a project.

System.IdentityModel.Tokens.Jwt 3.0.1包有一些问题:文件System.IdentityModel.Tokens.Jwt.dll和System.IdentityModel.Tokens.Jwt.Xml应放在目录lib \ net45中,但它们被放置而是在根目录中。这会导致NuGet认为包是一个解决方案级别的包,并且不会将包安装到项目中。

This problem was fixed in System.IdentityModel.Tokens.Jwt 3.0.2

System.IdentityModel.Tokens.Jwt 3.0.2中修复了此问题

#1


3  

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/en-us/library/dn205064(v=vs.110).aspx所以,我查看包历史,最后我安装上一个包http://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/3.0.0

It works fine for me.

这对我来说可以。

#2


0  

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

指定'packages'文件夹位置

In the past, NuGet has managed a solution’s packages from a known ‘packages’ folder found beneath the solution root directory. 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 2.1 provides more granular control over the location of the packages folder via the ‘repositoryPath’ element in the NuGet.config file. 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. To accomplish this, simply add the following entry to C:\myteam\nuget.config.

过去,NuGet已经从解决方案根目录下的已知“包”文件夹管理了解决方案的包。对于具有许多安装了NuGet软件包的不同解决方案的开发团队,这可能导致在文件系统上的许多不同位置安装相同的软件包。 NuGet 2.1通过NuGet.config文件中的'repositoryPath'元素提供了对packages文件夹位置的更精细控制。在前面的分层nuget.config支持示例的基础上,假设我们希望将所有项目都放在C:\ myteam \下共享相同的packages文件夹。要完成此操作,只需将以下条目添加到C:\ myteam \ nuget.config即可。

#3


0  

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. This causes NuGet to think the package is a solution level package, and will not install the package into a project.

System.IdentityModel.Tokens.Jwt 3.0.1包有一些问题:文件System.IdentityModel.Tokens.Jwt.dll和System.IdentityModel.Tokens.Jwt.Xml应放在目录lib \ net45中,但它们被放置而是在根目录中。这会导致NuGet认为包是一个解决方案级别的包,并且不会将包安装到项目中。

This problem was fixed in System.IdentityModel.Tokens.Jwt 3.0.2

System.IdentityModel.Tokens.Jwt 3.0.2中修复了此问题