无法安装 .NET Standard 2.0
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48449553/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't get .NET Standard 2.0 installed
提问by Justin
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 Standard 2.0 项目,但是在项目属性页面上,它只有 .NET Standard 1.6 的选项。我转到 Visual Studio > 工具 > 扩展和更新 > 更新 > 产品更新并将 Visual Studio 2017 升级到最新版本 (15.5.4.)
I also downloaded / installed the .Net Core 2.0 SDKs from both of these urls:
我还从这两个网址下载/安装了 .Net Core 2.0 SDK:
https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0-download.md
https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.0.0-download.md
For good measure I even rebooted, yet still no .NET Standard 2.0 option. What gives?
我什至重新启动,但仍然没有 .NET Standard 2.0 选项。是什么赋予了?
C:\WINDOWS\system32>dotnet --info .NET Command Line Tools (2.1.4)
Product Information: Version: 2.1.4 Commit SHA-1 hash: 5e8add2190
Runtime Environment: OS Name: Windows OS Version: 10.0.16299 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.4\
Microsoft .NET Core Shared Framework Host
Version : 2.0.5 Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54
C:\WINDOWS\system32>dotnet --info .NET 命令行工具 (2.1.4)
产品信息:版本:2.1.4 提交 SHA-1 哈希值:5e8add2190
运行时环境:操作系统名称:Windows 操作系统版本:10.0.16299 操作系统平台:Windows RID:win10-x64 基本路径:C:\Program Files\dotnet\sdk\2.1.4\
Microsoft .NET Core 共享框架主机
版本:2.0.5 内部版本:17373eb129b3b05aa18ece963f8795d65ef8ea54
回答by Justin
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!
事实证明,有人将 global.json 文件放在我们存储库的根目录下,该文件将 SDK 硬编码为 1.x 预览版。将其更新到 2.1.4 后,我开始获得 .NET Standard 2.0 项目选项!
回答by ATL_DEV
Go to Windows "App and Features" or "Install and Remove Programs" and make sure you have .NETCore SDK (x64) and or (x86). You may have only installed the (x64) and not the (x86). Try changing your project target to x64 and x86.
转到 Windows“应用程序和功能”或“安装和删除程序”并确保您拥有 .NETCore SDK (x64) 和或 (x86)。您可能只安装了 (x64) 而没有安装 (x86)。尝试将您的项目目标更改为 x64 和 x86。
Refer to this article for installing .NET Standard 2.0
请参阅本文以安装 .NET Standard 2.0
https://blogs.msdn.microsoft.com/benjaminperkins/2017/09/20/how-to-install-net-standard-2-0/
https://blogs.msdn.microsoft.com/benjaminperkins/2017/09/20/how-to-install-net-standard-2-0/
回答by NightOwl888
When I click on "Install Other Frameworks..." in project properties, it takes me to this page:
当我单击项目属性中的“安装其他框架...”时,它会将我带到此页面:
https://blogs.msdn.microsoft.com/benjaminperkins/2017/09/20/how-to-install-net-standard-2-0/
https://blogs.msdn.microsoft.com/benjaminperkins/2017/09/20/how-to-install-net-standard-2-0/
And it appears that the installer on that page (dotnet-sdk-2.1.4-windows-x64-installer) is different than the one in the other links you have tried.
并且该页面 ( dotnet-sdk-2.1.4-windows-x64-installer)上的安装程序似乎与您尝试过的其他链接中的安装程序不同。
Also, be sure that all instances of Visual Studio are closed when you install the SDK.
此外,请确保在安装 SDK 时关闭所有 Visual Studio 实例。

