I am getting this error when I try to deploy my .netcore 2.2 application:
It was not possible to find any compatible framework version The specified framework 'Microsoft.NETCore.App', version '2.2.4' was not found. - Check application dependencies and target a framework version installed at: C:\Program Files\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: 1.0.4 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 1.1.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 1.1.12 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.0.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.0.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.1.2 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.1.4 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 2.2.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
In my local machine when I run:
dotnet --version
I get this response: "2.2.102" and the app runs fine. I have also only installed Microsoft.NET Core Runtime - 2.2.1 and Microsoft .NET Core SDK 2.2.102. So version 2.2.4 is not supported.
This is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule"/>
</modules>
<aspNetCore processPath="dotnet" arguments=".\Optics.API.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>
This my .csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.1" PrivateAssets="All"/>
<PackageReference Include="Hangfire.Core" Version="1.7.0"/>
<PackageReference Include="Hangfire.SqlServer" Version="1.7.0"/>
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.0"/>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.1"/>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="4.0.1"/>
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0"/>
</ItemGroup>
</Project>
I have also tested by removing the version of Microsoft.AspNetCore.App
<PackageReference Include="Microsoft.AspNetCore.App"/>
But even with that change I get the same error. Furthermore the app is deployed in a shared hosting server and I have no authority to install any sdk or runtime, so I should work with the existing. Any clues?
dotnet --info
command on your local machine? Dependency graph can also be helpful. You can generate it by navigating to your project and then rundotnet msbuild /t:GenerateRestoreGraphFile /p:RestoreGraphOutputPath=graph.dg
command which will generategraph.dg
file which is json file. – Mohsin Mehmood