当前的.NET SDK不支持定位.NET Core 2.1。目标.NET Core 2.0或更低版本,或使用支持.NET Core 2.1的.NET SDK [英] The current .NET SDK does not support targeting .NET Core 2.1. Either target .NET Core 2.0 or lower, or use a .NET SDK that supports .NET Core 2.1

查看:124
本文介绍了当前的.NET SDK不支持定位.NET Core 2.1。目标.NET Core 2.0或更低版本,或使用支持.NET Core 2.1的.NET SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已尝试升级到Visual Studio 2017 v 15.6.0(Preview 7.0)的专业版

have tried upgrading to the professional version of visual studio 2017 v 15.6.0 (Preview 7.0)

并安装了aspnetcore-runtime-2.1.0-preview1-final -win-x64和.net核心SDK 2.1.4。

and installed aspnetcore-runtime-2.1.0-preview1-final-win-x64 and .net core SDK 2.1.4.

当我创建新的Web应用程序时,出现错误提示

When I created a new web application I get an error saying


当前的.NET SDK不支持目标.NET Core 2.1。
目标是.NET Core 2.0或更低版本,或者使用的版本是.NET SDK
支持.NET Core 2.1。

"The current .NET SDK does not support targeting .NET Core 2.1. Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1."

当我尝试构建现有项目时出现错误

When I try to build an existing project I get an error


当前的.NET SDK不支持目标.NET Core 2.1。
目标是.NET Core 2.0或更低版本,或者使用版​​本
支持.NET Core 2.1的.NET SDK中。

"The current .NET SDK does not support targeting .NET Core 2.1. Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1."

我看不到 .net core 2.1在我的目标框架中

I don't see ".net core 2.1" in my target framework

我的计算机中没有global.json文件

I don't have global.json file in my computer

当我尝试时dotnet --info,我得到了这个

When I try dotnet --info, I get this


c:\source\dnacloud\testapp> dotnet --info .NET命令行工具
(2.1.100)

c:\source\dnacloud\testapp>dotnet --info .NET Command Line Tools (2.1.100)

Product Information:
Version: 2.1.100
Commit SHA-1 hash: b9e74c6

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.100\

Microsoft .NET Core Shared Framework Host

Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54



推荐答案

这里的问题是,微软使很多人对其.NET Core SDK的编号方式感到困惑。

The problem here is that Microsoft confused a whole lot of people with how they numbered their .NET Core SDKs.

在原始发帖人的消息中,路径是C:\Program Files\dotnet\sdk\2.1.100\似乎不代表.NET Core 2.1运行时(但您认为确实如此)。

In the original poster's message the path C:\Program Files\dotnet\sdk\2.1.100\ DOES NOT appear to represent the .NET Core 2.1 runtime (but you'd think it does).

我碰到了这篇帖子当前的.NET SDK不支持目标.NET Core 2.1 在developercommunity.visualstudio.com上,Microsoft支持人员解释了其中的困惑:

I came across this post The current .NET SDK does not support targeting .NET Core 2.1 on developercommunity.visualstudio.com where a Microsoft support person explains the confusion:


谢谢您的反馈!我们确定此问题是
而非错误。具有.NET Core 2.1支持的第一个SDK是
2.1.300-preview1。我们知道版本令人困惑,这就是为什么从2.1.300开始,SDK的major.minor版本现在也将与运行时的major.minor版本保持一致的原因。

"Thank you for your feedback! We have determined that this issue is not a bug. The first SDK with .NET Core 2.1 support is 2.1.300-preview1. We know the versioning is confusing which is why starting in 2.1.300, the major.minor versions of the SDK will now be aligned with the major.minor versions of the runtime as well."

所以...为了获得通过SDK进行构建的.NET Core 2.1支持,您需要至少安装版本为2.1.300的SDK(因为2.1.2不是.NET Core 2.1)...是的,令人困惑。感谢Microsoft在此方面的一些浪费时间。

So ... in order to get .NET Core 2.1 support for building via the SDK you need to install the SDK with version 2.1.300 at least (since 2.1.2 is NOT .NET Core 2.1) ... yeah, confusing. Thank you Microsoft for some lost time on this.

这篇关于当前的.NET SDK不支持定位.NET Core 2.1。目标.NET Core 2.0或更低版本,或使用支持.NET Core 2.1的.NET SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆