简体   繁体   English

VS2017 - 缺少 .net core > 2.1 作为目标框架

[英]VS2017 - Missing .net core > 2.1 as target framework

Solution found!找到解决方案! Took awhile, installed ALL sdks, and ALL runtimes then reinstalled latest version I wanted!花了一段时间,安装了所有 sdks 和所有运行时,然后重新安装了我想要的最新版本!

Goal, Have netcore 2.1 or greater as a dropdown option in visual studio.目标,将 netcore 2.1 或更高版本作为 Visual Studio 中的下拉选项。 I've looked at possible duplicates questions already!我已经看过可能的重复问题了!

Details细节

After the last update of visual studio 15.7 to 15.8.4 .net core 2.1 or greater has disappeared from the target framework list.在visual studio 15.7 到15.8.4 的最后一次更新之后,.net core 2.1 或更高版本已经从目标框架列表中消失了。

I looked at other solutions as seen below.我查看了其他解决方案,如下所示。 They were not helpful as I installed every version under the sun.它们没有帮助,因为我在阳光下安装了每个版本。 See below screens.请参阅以下屏幕。

Checked below for solutions (I already looked for solutions here!) : VS2017 : Target framework drop down does not show .NET Core 2.1 option检查下面的解决方案(我已经在这里寻找解决方案!)VS2017:目标框架下拉不显示 .NET Core 2.1 选项

The current .NET SDK does not support targeting .NET Core 2.1. 当前的 .NET SDK 不支持面向 .NET Core 2.1。 target .NET Core 2.0 or lower or use a vs of the .NET SDK that support NET Core 2.1 面向 .NET Core 2.0 或更低版本或使用支持 NET Core 2.1 的 .NET SDK 的 vs

Referenced screens:参考画面: 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 在此处输入图片说明

UPDATE1: Removed 2.2 preview (NOT SOLVED, 2.1 is still missing) UPDATE1:删除了 2.2 预览版(未解决,2.1 仍然缺失) 在此处输入图片说明

In general, when new preview version of .NET Core 2.X appears and you are getting the error like this:通常,当.NET Core 2.X预览版本出现时,您会收到如下错误:

The current .NET SDK does not support targeting .NET Core 2.X当前的 .NET SDK 不支持面向 .NET Core 2.X

Make sure that:确保:

  1. You have downloaded installed SDK and runtime you need.您已下载所需的已安装 SDK 和运行时。 Run command dotnet --info to see what you have installed on your machine at the moment.运行命令dotnet --info以查看您目前在计算机上安装的内容。

  2. You have checked the Use previews of the .NET Core SDK option here:您已在此处选中使用 .NET Core SDK选项的预览

-> Tools -> Options -> Projects and Solutions -> .NET Core

Sometimes you might need to restart your Visual Studio after checking the option.有时,您可能需要在选中该选项后重新启动Visual Studio

Note: it's always better to have the most recent Visual Studio version installed on your development machine (sometimes you might need a preview version - note a Download Preview link).注意:在您的开发机器上安装最新的 Visual Studio 版本总是更好(有时您可能需要preview版本 - 请注意Download Preview链接)。

The user said, that my comment fixed the issue .用户说, 我的评论解决了这个问题 So I'll post it as answer:所以我会把它作为答案发布:

On the picture I see a lot of installed .Net Core SDKs, maybe Visual Studio has some issues with so many installed SDKs.在图片上我看到很多已安装的 .Net Core SDK,也许 Visual Studio 在安装了这么多 SDK 时存在一些问题。

So move all old SDK folders (1.0 preview, 2.0, 2.1 except 2.1.402) out of this folder to a backup location and launch Visual Studio again.因此,将所有旧 SDK 文件夹(1.0 预览版、2.0、2.1 除 2.1.402 外)移出此文件夹到备份位置并再次启动 Visual Studio。

I had this issue as well, this is what I did and it worked for me, It may or may not for you.我也有这个问题,这就是我所做的,它对我有用,它可能适合也可能不适合你。 I uninstalled everything after 2.0.我在 2.0 之后卸载了所有东西。 I then went to this link https://www.microsoft.com/net/download and downloaded both the SDK and Run-time downloads for 2.1 then after installing them I restarted my laptop and booted up VS2017.然后我转到此链接https://www.microsoft.com/net/download并下载了 2.1 的 SDK 和运行时下载,然后在安装它们后我重新启动了我的笔记本电脑并启动了 VS2017。 I then went and tried creating a new web app MVC and selected .netcore 2.1 it was there.然后我去尝试创建一个新的 Web 应用程序 MVC 并选择它在那里的 .netcore 2.1。

However keep in mind .netcore 2.1 is not yet available for every template you have so check web app MVC template first if its there then you have 2.1 it just may not be available for a specific template you might be trying to use it for yet.但是请记住,.netcore 2.1 还不适用于您拥有的每个模板,因此请先检查 Web 应用程序 MVC 模板,如果它存在,那么您有 2.1 它可能不适用于您可能尝试使用它的特定模板。

Hope this helps希望这可以帮助

In my case solution was: i removed few .NET Core SDK:s from "Add remove programs" and restarted visual studio.就我而言,解决方案是:我从“添加删除程序”中删除了一些 .NET Core SDK:s 并重新启动了 Visual Studio。 Than SDK that i need was in the list比我需要的 SDK 在列表中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM