无法为netstandard1.x项目安装Netstandard1.x Nuget软件包

编程入门 行业动态 更新时间:2024-10-27 06:32:22
本文介绍了无法为netstandard1.x项目安装Netstandard1.x Nuget软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在全新安装了Windows 10以及最新的Visual Studio 2015,netcore和nuget工具之后,我无法再将Nuget软件包安装到任何standard项目中。下面是一些示例输出:

After doing a fresh Windows 10 installation along with latest Visual Studio 2015, netcore, and nuget tooling - I can no longer install Nuget packages to any standard projects. Here's some example output:

Restoring packages for 'ClassLibrary1'. Restoring packages for c:\users\zone1\documents\visual studio 2015\Projects\ClassLibrary1\ClassLibrary1\project.json... Package System.ComponentModel.EventBasedAsync 4.0.11 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package System.ComponentModel.EventBasedAsync 4.0.11 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net45 (.NETFramework,Version=v4.5) - netcore50 (.NETCore,Version=v5.0) - netstandard1.0 (.NETStandard,Version=v1.0) - netstandard1.3 (.NETStandard,Version=v1.3) - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259) - win8 (Windows,Version=v8.0) - wp8 (WindowsPhone,Version=v8.0) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) One or more packages are incompatible with .NETStandard,Version=v1.3. Package restore failed for 'ClassLibrary1'.

我将项目ClassLibrary1创建为可移植类库,将目标更改为netstandard1.3,但无法安装任何显示对netstandard1.3支持的Nuget软件包。同样,netstandard1.5和其他版本也是如此。

I created the project ClassLibrary1 as a portable class library, change the target to netstandard1.3, and cannot install any Nuget packages that show support for netstandard1.3. Same goes for netstandard1.5 and the other versions.

我只是尝试为 MailKit (一个支持standard的项目),以验证我的项目设置是否正确,并遇到了相同的问题:

I just trying pulling and building the source for MailKit (a project that supports standard) to verify I wasn't setting up my project wrong and am getting the same problem:

Errors in C:\Users\zone1\Repos\MailKit\MailKit\MailKit.CoreFX.xproj Package System.Net.NetworkInformation 4.1.0 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package System.Net.NetworkInformation 4.1.0 supports: - monoandroid10 (MonoAndroid,Version=v1.0) - monotouch10 (MonoTouch,Version=v1.0) - net45 (.NETFramework,Version=v4.5) - netcore50 (.NETCore,Version=v5.0) - netstandard1.0 (.NETStandard,Version=v1.0) - netstandard1.3 (.NETStandard,Version=v1.3) - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259) - win8 (Windows,Version=v8.0) - wp8 (WindowsPhone,Version=v8.0) - wpa81 (WindowsPhoneApp,Version=v8.1) - xamarinios10 (Xamarin.iOS,Version=v1.0) - xamarinmac20 (Xamarin.Mac,Version=v2.0) - xamarintvos10 (Xamarin.TVOS,Version=v1.0) - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0) One or more packages are incompatible with .NETStandard,Version=v1.3.

我在此处发布了更多详细信息:github/NuGet/Home/issues/3433

I've posted some more details here: github/NuGet/Home/issues/3433

在重新格式化之前,所有这些都有效全新安装的Windows。我想念什么吗?

This all worked before I reformatted with a fresh Windows installation. Am I missing something?

推荐答案

感谢 @ eddie-msft 。

从此处 dist.nuget/index.html (在发布时为v3.5.0-rc1 )

然后运行:

nuget.exe当地-清除所有

我确保已关闭VS并删除了所有现有的project.lock.json文件。现在一切似乎都按预期工作。

I made sure to have VS closed and deleted any existing project.lock.json files. Now everything seems to work as intended.

我发现这个问题是在任何全新安装Windows / VS / tooling的系统上发生的,因此很可能是安装程序存在错误。

I found this problem to occur on any system with a fresh installation of Windows/VS/tooling so likely a bug with their installers.

更多推荐

无法为netstandard1.x项目安装Netstandard1.x Nuget软件包

本文发布于:2023-11-14 08:57:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586779.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:软件包   项目   Nuget

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!