1

I upgraded my applications form net core 2 to net core 2.1. I followed microsoft's upgrade instructions and locally all works fine. However when i try to publish a dot net core web app with visual studio i get the message bellow like the upgrade did not happen at all:

Severity Code Description Project File Line Suppression State Error This version of Microsoft.AspNetCore.App is only compatible with the netcoreapp2.1 target framework. Please target netcoreapp2.1 or choose a version of Microsoft.AspNetCore.App compatible with netcoreapp2.0.

<PropertyGroup>
  <TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

...........

 <ItemGroup>
   <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
</ItemGroup>

I know that i am not supposed to have a version in Microsoft.AspNetCore.App but visual studio 2017 (v15.7.3) does not recognize the referenced libraries otherwise. However this should not be a problem for publishing.

Any help would be appreciated.

2
  • Did you install the latest .NET Core SDK (2.1.300)? You can find it here: microsoft.com/net/download/windows. Tip: it does not ship with Visual Studio yet, you need to install it manually. Jun 21, 2018 at 7:13
  • Yes, ofcourse. Otherwise it would not work locally. Locally everything runs fine. By the way also tried updating vs to v15.7.4. Nothing changed.
    – T M
    Jun 21, 2018 at 8:06

1 Answer 1

3

Seems that in .pubxml file the targetframework is set also and since I created the publish file with version 2.0 it never updated the xml:

<TargetFramework>netcoreapp2.0</TargetFramework>

Problem solved after editing it by hand to 2.1.

1
  • Strange how Visual Studio team slip those annoying details Jan 5, 2019 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.