本文介绍了无法安装 .NET Standard 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个 .NET Standard 2.0 项目,但是在项目属性页面上,它只有最多 .NET Standard 1.6 的选项.我转到 Visual Studio > 工具 > 扩展和更新 > 更新 > 产品更新并将 Visual Studio 2017 升级到最新版本(15.5.4.)

I'm trying to create a .NET Standard 2.0 project, however on the project properties page it only has options up to .NET Standard 1.6. I went to Visual Studio > Tools > Extensions and Updates > Updates > Product Updates and upgraded Visual Studio 2017 to the latest version (15.5.4.)

我还从这两个网址下载/安装了 .Net Core 2.0 SDK:

I also downloaded / installed the .Net Core 2.0 SDKs from both of these urls:

https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0-download.md

https://www.microsoft.com/net/learn/get-started/windows?utm_expid=.-Fmi9Q05Ry2oXQgdtPElHw.0&utm_referrer=http%3A%2F%2Fwww.talkingdotnet.com%2Fwhats-new-in-net-standard-2%2F#windowscmd

我什至重新启动,但仍然没有 .NET Standard 2.0 选项.什么给?

For good measure I even rebooted, yet still no .NET Standard 2.0 option. What gives?

C:WINDOWSsystem32>dotnet --info .NET 命令行工具 (2.1.4)

产品信息:版本:2.1.4 提交 SHA-1 哈希:5e8add2190

Product Information: Version: 2.1.4 Commit SHA-1 hash: 5e8add2190

运行时环境:操作系统名称:Windows 操作系统版本:10.0.16299操作系统平台:Windows RID:win10-x64 基本路径:C:ProgramFilesdotnetsdk2.1.4

Runtime Environment: OS Name: Windows OS Version: 10.0.16299 OS Platform: Windows RID: win10-x64 Base Path: C:Program Filesdotnetsdk2.1.4

Microsoft .NET Core 共享框架主机

Microsoft .NET Core Shared Framework Host

版本:2.0.5 构建:17373eb129b3b05aa18ece963f8795d65ef8ea54

Version : 2.0.5 Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54

推荐答案

事实证明,有人将 global.json 文件放在我们存储库的根目录下,该文件将 SDK 硬编码为 1.x 预览版.将其更新到 2.1.4 后,我开始获得 .NET Standard 2.0 项目选项!

It turns out that someone had put a global.json file at the root of our repo that was hard-coding the SDK to a 1.x preview version. Once I updated that to 2.1.4, I started getting the .NET Standard 2.0 project option!

这篇关于无法安装 .NET Standard 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 04:43