首页 > 解决方案 > Error publishing to Azure after upgrade to netcoreapp2.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.

标签: c#asp.net-core.net-core

解决方案


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.


推荐阅读