简体   繁体   English

无法安装Nuget软件包

[英]Can't Install Nuget Package

I am trying to install System.Runtime.Handles so I can use SafeAccessTokenHandle and RunImpersonated , however when I try to install the package I get the error : 我正在尝试安装System.Runtime.Handles以便可以使用SafeAccessTokenHandleRunImpersonated ,但是当我尝试安装软件包时,出现错误消息:

Could not install package 'System.Runtime.Handles 4.3.0'. 无法安装软件包“ System.Runtime.Handles 4.3.0”。 You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or content files that are compatible with that framework. 您正在尝试将此软件包安装到以'.NETFramework,Version = v4.5.2'为目标的项目中,但是该软件包不包含任何与该框架兼容的程序集引用或内容文件。 For more information, contact the package author. 有关更多信息,请与软件包作者联系。

I have done some research and I do not believe there is a .NETFramework, Version=v4.3.0 . 我已经做了一些研究,但我不相信有一个.NETFramework, Version=v4.3.0 Does anybody have an idea on how to install this package? 有人对如何安装此软件包有想法吗?

I have done some research and I do not believe there is a .NETFramework, Version=v4.3.0. 我已经做过一些研究,但我不相信有一个.NETFramework,版本= v4.3.0。 Does anybody have an idea on how to install this package? 有人对如何安装此软件包有想法吗?

First, you have to make sure the version of NuGet Package Manager for Visual Studio 2013 is the latest version 2.12.0.817, not the default version 2.8. 首先,您必须确保用于Visual Studio 2013的NuGet软件包管理器的版本是最新版本2.12.0.817,而不是默认版本2.8。 You can check it from Tools -> Extensions and Updates -> Installed . 您可以从Tools -> Extensions and Updates -> Installed

That because this nuget package require the NuGet 2.12 or higher. 那是因为此nuget软件包需要NuGet 2.12或更高版本。

在此处输入图片说明

Second, you should make sure you have installed the .net 4.6 and above. 其次,您应确保已安装.net 4.6及更高版本。 You should not change the framework version by unloading the project, opening the project file, changing the target framework, and then reloading the file. 您不应该通过卸载项目,打开项目文件,更改目标框架,然后重新加载文件来更改框架版本。 In this way, Visual Studio can not help to check if you have install that target framework. 这样,Visual Studio无法帮助您检查是否已安装该目标框架。 You should change it by right on the project select Properties -> Application -> Target framework : 您应该在项目上右击它,选择Properties > Application > Target framework

在此处输入图片说明

If you do not have target framework .net 46, you can click the Install other frameworks to install it. 如果没有目标框架.net 46,则可以单击“安装其他框架”进行安装。 For this question, you can just change your target framework to 4.7.1 directly. 对于这个问题,您可以直接将目标框架更改为4.7.1。

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

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

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