简体   繁体   English

无法在Visual Studio 2015 Web API项目中添加nuget程序包

[英]Can not add a nuget package in visual studio 2015 web api project

I am not able to add a simple nuget package in Visual Studio 2015 Web API project. 我无法在Visual Studio 2015 Web API项目中添加简单的nuget包。

I have Visual Studio 2015 Professional Update 1. 我有Visual Studio 2015专业更新1。

Following are the steps I am following: 以下是我要执行的步骤:

  1. Created a new ASP .NET Web Application project with "Web API" template from ASP.NET 5 templates. 使用来自ASP.NET 5模板的“ Web API”模板创建了一个新的ASP .NET Web应用程序项目。
  2. As soon as I get the project created my solution explorer show 2 DNX references. 创建项目后,我的解决方案资源管理器就会显示2个DNX参考。 (i) DNX 4.5.1 (ii) DNX Core 5.0 (i)DNX 4.5.1(ii)DNX Core 5.0
  3. Now I right click on project name and click "Manage Nuget Packages". 现在,我右键单击项目名称,然后单击“管理Nuget程序包”。
  4. I search for JSON package and I see "Newtonsoft.Json" in the results. 我搜索JSON包,结果中看到“ Newtonsoft.Json”。 And I go ahead and select "Latest stable 8.0.2" version and hit install. 我继续,选择“最新稳定版8.0.2”版本并点击安装。

Result: Not able to add package: 结果:无法添加包:

And this is one of last few lines in the output window "Unable to locate Dependency Newtonsoft.Json >= 8.0.2" 这是输出窗口“无法找到Dependency Newtonsoft.Json> = 8.0.2”的最后几行之一

Errors windows says something different" 错误窗口表示有所不同”

Error NU1001 The dependency Newtonsoft.Json >= 6.0.6 could not be resolved. 错误NU1001无法解决依赖项Newtonsoft.Json> = 6.0.6。

Would be great if someone can help. 如果有人可以提供帮助,那就太好了。

FYI: my project.json looks like this: 仅供参考:我的project.json看起来像这样: 在此处输入图片说明

Please let me know if there is some more info I should add, I can share all steps screen shots. 请让我知道是否需要添加更多信息,我可以共享所有步骤的屏幕截图。

I also have been bangin' my head with this for 5 days already. 我也已经为此动了5天。

I have been trying to install the erroneous library using the nuget, both on console and the GUI. 我一直试图使用nuget在控制台和GUI上安装错误的库。 Did not work and it made me nuts and go wild. 没有工作,这让我发疯了。 Only to find out, that the solution was to locate the library manually on your local drive located on your users folder, you should find a folder /.dnx/packages 只是发现解决方案是手动将库放在用户文件夹中的本地驱动器上,所以您应该找到一个文件夹/.dnx/packages

Locate your library on that folder, adding it manually. 在该文件夹中找到您的库,然后手动添加。 I'm not sure if this is the case with you, but it worked for me. 我不确定您是否遇到这种情况,但这对我有用。

Hope this helps. 希望这可以帮助。

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

相关问题 Visual Studio 2015 - NuGet包删除所有项目引用 - Visual Studio 2015 - NuGet package removes all project references 是否有任何 NuGet API 可以从 Visual Studio 扩展项目创建包 - Is there any NuGet API to create a Package from a Visual Studio Extension project 在不使用Visual Studio的情况下将nuget包添加到项目文件中 - Add nuget package into project file without Visual Studio 在没有Visual Studio的项目中添加NuGet包 - Adding a NuGet package to a project without Visual Studio 为什么Visual Studio 2015无法在github上打开区块链api项目 - Why visual studio 2015 can not open blockchain api project on github Visual Studio 2015更新3无法读取NuGet程序包 - Visual Studio 2015 update 3 cannot read NuGet package NuGet包在visual studio 2015和Xamarin中引起麻烦 - NuGet package causes trouble in visual studio 2015 and Xamarin 无法在 Visual Studio 2015 中添加项目引用 - Unable to add project reference in Visual Studio 2015 无法将 C# class 添加到 Web API 项目 - Visual Studio 21 - Can't add C# class to Web API Project - Visual Studio 2019 引用 a.Net Core 3.1 NuGet package 的 a.Net 5 Visual Studio 项目/解决方案如何编译成功? - How can a .Net 5 Visual Studio Project / Solution that reference a .Net Core 3.1 NuGet package compile successfuly?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM