21

So I've installed the official .NET Core 2.0 SDK and when I'm in Visual Studio i get heaps of errors and the target framework is not listed :(

It's like .NET Core 2.0 isn't installed.

enter image description here

and here's the .csproj file:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
  </ItemGroup>

</Project>

also, dotnet --version returns 2.0.0

so .. is there some install tooling I'm missing?

EDIT/UPDATE:

Here's my system info from VS:

Microsoft Visual Studio Community 2017 
Version 15.3.1
VisualStudio.15.Release/15.3.1+26730.8
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Community

Visual Basic 2017   00369-60000-00001-AA912
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA912
Microsoft Visual C# 2017

Application Insights Tools for Visual Studio Package   8.8.00712.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30726.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   1.0
Provides languages services for ASP.NET Core Razor.

ASP.NET Template Engine 2017   15.0.30726.0
ASP.NET Template Engine 2017

ASP.NET Web Frameworks and Tools 2017   5.2.50601.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.0.30728.0
Azure App Service Tools v3.0.0

... rest snipped.
Pure.Krome
  • 78,923
  • 102
  • 356
  • 586
  • 7
    do you use visual studio 2017? See the "note" https://docs.microsoft.com/en-us/dotnet/core/windows-prerequisites?tabs=netcore2x under ".NET Core dependencies". In the About Microsoft Visual Studio dialog, verify the version number. For .NET Core 2.x apps, Visual Studio 2017 version 15.3 (26730.01) or higher. For .NET Core 1.x apps, Visual Studio 2017 version 15.0 (26228.04) or higher. – Benjamin Schäublin Aug 20 '17 at 06:07

6 Answers6

28

Please make sure you use Visual Studio 2017 Update 3 (version 15.3, 26730.01): Help -> About Microsoft Visual Studio

Dávid Molnár
  • 7,524
  • 6
  • 25
  • 43
  • I would suggest adding, that to update, just click the flag at the top right, and click update from the listing – Bostwick Mar 16 '18 at 19:54
  • Could you please be more specific? I haven't found the flag you mentioned. – Dávid Molnár Mar 17 '18 at 10:15
  • @DávidMolnár: The so called notification flag is at the top right corner of Visual Studio 2017, usually painted in bright yellow color, near to the close button. Just click on it, or, alternatively, just run the Visual Studio Installer +1 – sɐunıɔןɐqɐp Sep 18 '18 at 08:12
18

Ah!

I had the following global.json in the root of my solution:

{
  "projects": [ "src", "tests" ],
  "sdk": {
    "version": "1.0.4"
  }
}

So I had to change the version from 1.0.4 to 2.0.0 and then close/re-open the solution.

Problem solved :)

Pure.Krome
  • 78,923
  • 102
  • 356
  • 586
  • This is exactly the solution, if you do not see .NET Core 2.0 in the target framework of the motst current Visual Studio 2017! – utopia Aug 31 '17 at 09:41
  • 2
    I'm using VS 2017 15.3.3, which I just installed a few days ago, and 2.0 is not an option for me. There is no option to select .NET Core 2.0 as the target for new or existing 1.1 projects I've been working on. I can create and run new 1.1 projects and open/run existing ones, just fine. Argh. – Tsar Bomba Sep 07 '17 at 14:37
  • Ha! OK...all I had to do was download the 2.0 SDK separately, then reboot VS. I didn't see that anywhere - it just sounded like all you had to do was install the latest VS 2017 release. All good now. – Tsar Bomba Sep 07 '17 at 14:59
  • Searched all of the internet, eventually found the solution myself and wanted to share, searched for a topic on stackoverflow to post this answer to, then found this... Can't upvote this enough. – Tom Dec 11 '17 at 09:07
  • ^Deleting the file was not a permanent solution. It came back as `1.0.0-beta4`. – Tom Dec 11 '17 at 12:39
  • Thanks! this helped after struggling for 2 hours for finding the solution. – Shaggy Sep 05 '18 at 01:15
1

In my case this was caused by another executable called "dotnet.exe" that was in my path before the one from the SDK. It seems that VS doesn't deal with this well.

EM0
  • 4,299
  • 6
  • 36
  • 63
1

You may need to add "%USERPROFILE%\.dotnet\" to your PATH. The Entity Framework Core project mentions it.

Jared Beach
  • 1,708
  • 26
  • 31
1

I just ran into this issue. Reinstalling the sdk and VS didn't help. The issue ended up being an incorrect order of paths in the System Path variable. As soon as I moved C:\Program Files\dotnet\ before C:\Program Files (x86)\dotnet\ VS was able to pickup the correct sdks.

System Path variable

Augusto Barreto
  • 3,467
  • 4
  • 25
  • 35
0

For using .net core 2 or higher, you need visual studio 15.3 version or higher,update your visual studio and then, you need to install SDK.

masehhat
  • 540
  • 4
  • 9
  • 2
    All this information was already mentioned in the previous solutions months ago. Please improve your answer, otherwise it does not seem to provide a [quality answer](https://stackoverflow.com/help/how-to-answer) to the question. – sɐunıɔןɐqɐp Sep 18 '18 at 08:15