Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"It was not possible to find any compatible framework version" with ASP.NET Core 2.2

I have an ASP.Net Core MVC 2.2 application. Running the application in Visual Studio works fine. However, when I try to publish the application using dotnet publish I get the following error:

It was not possible to find any compatible framework version
  The specified framework 'Microsoft.NETCore.App', version '1.0.0' 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:
        2.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
        2.1.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
        2.1.6 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
        2.1.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
        2.1.8 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
        2.1.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
        2.2.2 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
        2.2.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

I do not understand where there could be a reference to V 1.0.0, here ist the output of dotnet --info

.NET Core SDK (gem„á "global.json"):
 Version:   2.2.105
 Commit:    7cecb35b92

Laufzeitumgebung:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.2.105\

Host (useful for support):
  Version: 2.2.3
  Commit:  6b8ad509b6

.NET Core SDKs installed:
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.403 [C:\Program Files\dotnet\sdk]
  2.1.500 [C:\Program Files\dotnet\sdk]
  2.1.502 [C:\Program Files\dotnet\sdk]
  2.1.503 [C:\Program Files\dotnet\sdk]
  2.1.504 [C:\Program Files\dotnet\sdk]
  2.1.505 [C:\Program Files\dotnet\sdk]
  2.2.104 [C:\Program Files\dotnet\sdk]
  2.2.105 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [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.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

No global.json file is used, the *.csproj file looks like:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
   <TargetFramework>netcoreapp2.2</TargetFramework>
    <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <AssemblyName>a17e.Web</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageId>a17e.Web</PackageId>
    <TypeScriptToolsVersion>3.1</TypeScriptToolsVersion>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='thi|AnyCPU'" />

  <ItemGroup>
    <None Include="App.config" />
    <None Update="log4net.config">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </None>
    <None Update="Views\**\*;Areas\**\*.cshtml">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </None>
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\a17e.Application\a17e.Application.csproj" />
    <ProjectReference Include="..\a17e.EntityFrameworkCore\a17e.EntityFrameworkCore.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Castle.LoggingFacility.MsLogging" Version="3.1.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
    <PackageReference Include="BundlerMinifier.Core" Version="2.9.406" />
    <PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.4.0" />
    <PackageReference Include="Abp.AspNetCore" Version="4.4.0" />
    <PackageReference Include="Abp.Castle.Log4Net" Version="4.4.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="2.2.2" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="2.2.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="2.2.1" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Session" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.3">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.0" />
    <PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.5.1" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
    <Reference Include="System" />
    <Reference Include="Microsoft.CSharp" />
  </ItemGroup>

  <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
    <Exec Command="dotnet bundle" />
  </Target>

  <ItemGroup>
    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="logs\" />
    <Folder Include="wwwroot\css\views\account\" />
  </ItemGroup>

</Project>
like image 497
Tobias Schittkowski Avatar asked Mar 26 '19 14:03

Tobias Schittkowski


People also ask

Is .NET framework compatible with .NET core?

NET Framework is compatible only with the Windows operating system. . NET Core is compatible with open-source mobile application platforms, i.e. Xamarin, through the . NET Standard Library.

How do I find .NETCore version?

You can see both the SDK versions and runtime versions with the command dotnet --info .


1 Answers

I have the same issue when ran my .NET core solution. I resolved by installation of missing .NET core components: enter image description here

like image 141
Mr.B Avatar answered Sep 26 '22 00:09

Mr.B