当前的 .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

查看:56
本文介绍了当前的 .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 core 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 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."

我在目标框架中没有看到.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:sourcednacloud estapp>dotnet --info .NET 命令行工具(2.1.100)

c:sourcednacloud estapp>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 Filesdotnetsdk2.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 Filesdotnetsdk2.1.100 似乎并不代表 .NET Core 2.1 运行时(但您会认为它确实如此).

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

我看到这篇文章 当前的 .NET SDK 不支持针对 developercommunity.visualstudio.com 上的 .NET Core 2.1,微软支持人员解释了这个困惑:

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-预览1.我们知道版本控制令人困惑,这就是为什么从 2.1.300 开始,SDK 的主要.次要版本现在是也与运行时的主要.次要版本保持一致."

"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天全站免登陆