Reputation: 565
I want install ASP.NET Core app on the linux machine. For some reasons the only avalible deployment mode for me is Framework-Dependent. The linux machine has Microsoft.AspNetCore.App 2.2.6 installed:
# dotnet --list-runtimes
Microsoft.AspNetCore.All 2.2.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
I have several versions of .NET Core SDKs installed on my Windows machine (where I build the application):
dotnet --info
Пакет SDK для .NET Core (отражающий любой global.json):
Version: 2.2.401
Commit: 729b316c13
Среда выполнения:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.401\
Host (useful for support):
Version: 2.2.8
Commit: b9aa1abc51
.NET Core SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.508 [C:\Program Files\dotnet\sdk]
2.2.110 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
When I try to run my app on the linux machine:
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.2.8' was not foun d.
- Check application dependencies and target a framework version installed at:
/usr/share/dotnet/
- Installing .NET Core prerequisites might help resolve this problem:
https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download
- The following versions are installed:
2.2.6 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
I tried:
1) Create global.json file in the project directory:
{
"sdk": {
"version": "2.2.401",
"rollForward": "disable"
}
}
2) Select Microsoft.AspNetCore.App version in Nuget Package manager, but the selection is blocked.
Target framework is set to .NET Core 2.2 (on the Application tab of the project properties).
Content of my .csproj file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<None Remove="log4net_config.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="log4net_config.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="linq2db.Oracle.Managed" Version="2.9.4" />
<PackageReference Include="log4net" Version="2.0.8" />
<PackageReference Include="Microsoft.AspNetCore.App"/>
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Compile Update="alertFired.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>alertFired.xsd</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="alertFired.xsd">
<Generator>LxCodeGenerator</Generator>
<LastGenOutput>alertFired.cs</LastGenOutput>
</None>
</ItemGroup>
</Project>
Upvotes: 1
Views: 6833
Reputation: 565
The problem was in the publish profile. My profile was created when the project was targeted to .NET Core 2.1. Later I migrated to .NET Core 2.2 and maked according change in the existing profile. Obviously that change was not sufficient. To solve the problem I have deleted exiting profile and created new one targeted to .NET Core 2.2.
Upvotes: 2
Reputation: 1
Try to specify directly packages in your .csproj:
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.6" />
<PackageReference Include="Microsoft.NETCore.App" Version="2.2.6" />
and your SDK: <Project Sdk="Microsoft.NET.Sdk.Web" Version="2.2.401">
Upvotes: -1
Reputation: 29939
Your project was originally created for ASP.NET Core 2.0, but you didn't properly migrate it to 2.1 by updating its .csproj as per the guide.
Likely what will fix your issue is to edit the .csproj to change
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.2.8" />
to
<PackageReference Include="Microsoft.AspNetCore.App" />
but there are various other 2.0 packages that will be present in that file that are no longer needed in 2.1+, that you should also remove and/or correct.
I strongly suggest following the linked 2.0 to 2.1 migration guide fully, as well as the 2.1 to 2.2 migration guide.
Upvotes: 1