NetCore2.1->2.2 Upgrade Issue; TargetFramework dropped/not recognized
See original GitHub issueFrom @pinkfloydx33 on December 5, 2018 13:40
I’m trying to upgrade my web application from netCore 2.1 to 2.2. I have updated the TargetFramework to netcoreapp2.2 and I receive the following errors upon restore/build/clean:
MyProduct.Web.csproj : error NU1202: Package Microsoft.AspNetCore.App 2.2.0 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.AspNetCore.App 2.2.0 supports: netcoreapp2.2 (.NETCoreApp,Version=v2.2)
MyProduct.Web.csproj : error NU1202: Package Microsoft.NETCore.App 2.2.0 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package Microsoft.NETCore.App 2.2.0 supports: netcoreapp2.2 (.NETCoreApp,Version=v2.2)
MyProduct.Web.csproj : error NU1202: Package Microsoft.AspNetCore.App 2.2.0 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1) / win-x64. Package Microsoft.AspNetCore.App 2.2.0 supports: netcoreapp2.2 (.NETCoreApp,Version=v2.2)
MyProduct.Web.csproj : error NU1202: Package Microsoft.NETCore.App 2.2.0 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1) / win-x64. Package Microsoft.NETCore.App 2.2.0 supports: netcoreapp2.2 (.NETCoreApp,Version=v2.2)
I have also done a manual clean (deleting obj/bin directories).
I can build if I change from using <TargetFramework>
to <TargetFrameworks>
, however I’d rather not do this and attempt to locate the underlying issue. I have two test projects in the same solution that reference the main project. I was able to migrate them to netcoreapp2.2 without switching to TargetFrameworks, I would like to do the same thing for the main web app.
When I use TargetFramework (singular), Visual Studio updates the dependencies graph and removes the SDK node:
I’ve tried adding a global.json specifying the SDK version directly as 2.2.100 but that doesn’t make any difference.
Here is my .csproj file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<AssemblyName>MyProduct.Web</AssemblyName>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PackageId>$(AssemblyName)</PackageId>
<Authors>MyCompany</Authors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<RazorCompileOnBuild>false</RazorCompileOnBuild>
<RazorCompileOnPublish>false</RazorCompileOnPublish>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Update="wwwroot\**\*">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyProduct.Web.Core\MyProduct.Web.Core.csproj" />
<ProjectReference Include="..\MyProduct.Web.Api.Contracts\MyProduct.Web.Api.Contracts.csproj" />
<ProjectReference Include="..\MyProduct.Web.ViewModels\MyProduct.Web.ViewModels.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="BeginCollectionItemCore" Version="1.0.4" />
<PackageReference Include="Novell.Directory.Ldap.NETStandard" Version="2.3.5" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.0" PrivateAssets="All" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
</ItemGroup>
<ItemGroup>
<Content Update="Views\_ViewImports.cshtml">
<Pack>$(IncludeRazorContentInPack)</Pack>
</Content>
</ItemGroup>
</Project>
Copied from original issue: dotnet/corefx#33834
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
@sven5 If you have any saved publish profiles, make sure you’ve updated the framework version inside them as well.
Had to do the the above but also I additionally had to update deployment scripts as my output path had changed to reflect the new version. Best to do a search for all references of netcoreapp2.1