-1

Running VS version 15.9.4, I followed Microsoft's instructions (I think), but I'm still having trouble upgrading an existing 2.1 project to the latest stable (2.2.3).

Here is my dotnet --info enter image description here

And here is my project file:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <Configurations>Debug;Release;DEBUG_LOCALAPI</Configurations>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
  </PropertyGroup>

  <ItemGroup>
    <Content Remove="appsettings.Development.json" />
    <Content Remove="appsettings.json" />
  </ItemGroup>

  <ItemGroup>
    <None Include="appsettings.Development.json" />
    <None Include="appsettings.json" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="3.0.0" />
    <PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\PublishingAPICommon\PublishingAPICommon.csproj" />
  </ItemGroup>

</Project>

If I try to install 2.2.3 to that project from NuGet manager, this is the error message I get:

Severity Code Description Project File Line Suppression State Error NETSDK1045 The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2. PublishingStorage C:\Program Files\dotnet\sdk\2.1.502\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 137

And here is what I see in VS when I try to edit the project properties directly: enter image description here

Things I have tried:

  1. Re-starting VS
  2. Re-starting my machine
  3. Creating a project-scoped global.json file with 2.2.3 value
Tracy
  • 680
  • 7
  • 16

1 Answers1

0

From @martin-ullrich on https://github.com/aspnet/AspNetCore.Docs/issues/11844

Go to https://dotnet.microsoft.com/download/dotnet-core/2.2 and download the installer for the 2.2.105 version. Anything >= 2.2.200 will not work in VS 2017. Both 2.2.105 and 2.2.202 contain the latest and greatest .NET Core 2.2 version but they differ in the version of the tools they include and are based on - the 1xx train is MSBuild 15., NuGet 4. etc. and the 2xx train is MSBuild 16., NuGet 5. and so on and Visual Studio only looks for the latest version compatible with its version of MSBuild - for VS 2017 this is 2.1.502 version which cannot target .NET Core 2.2. (And to add more confusion, there are now 2.1.6xx versions with VS 2019 tool versions together with the .NET Core 2.1 runtime)

[@]leecow and [@]rowanmiller are working on updating that page regarding VS, also see dotnet/core#2542 and dotnet/sdk#3076 which are about the same problem.


My contribution: After installing 2.2.105, I deleted the folder(s) titled '2.2.202' in directory C:\Program Files (x86)\dotnet\sdk and/or C:\Program Files\dotnet\sdk so that dotnet --info now reads the following: enter image description here

Tracy
  • 680
  • 7
  • 16