Меню

It was not possible to find any compatible framework version ошибка

I had a .Net Core console app built and deployed.

The project’s Platform target is x86.

Target framework is .Net Core 2.2(x86).

Although .Net Core 2.2 (x86) SDK is installed, I get following error after executing the command dotnet myapp.dll in Developer Command Prompt VS2017.

It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.2.0' was not found.
- The following versions are installed:
2.0.7 at [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
2.0.9 at [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
2.1.5 at [C:Program FilesdotnetsharedMicrosoft.NETCore.App]

The .Net Core 2.2(x86) SDK was installed under path «C:Program Files (x86)dotnetshared», and System Environment Variables contains «C:Program Files (x86)dotnet».

Any suggestion? Thanks!

~~~Update1

Following are part of .csproj info, sorry can’t show whole thing.

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <Platforms>AnyCPU;x86;x64</Platforms>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <PlatformTarget>x86</PlatformTarget>
    <Prefer32Bit>true</Prefer32Bit>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <PlatformTarget>x64</PlatformTarget>
    <Prefer32Bit>true</Prefer32Bit>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>

asked Dec 12, 2018 at 21:39

wltz's user avatar

wltzwltz

5911 gold badge9 silver badges22 bronze badges

11

After searching through Microsoft’s documentations, I noticed that I was missing an additional required Nugget package.

The documentation says:

Before you can use the tools on a specific project, you’ll need to add
the Microsoft.EntityFrameworkCore.Design package to it.

This is what I did by adding the package

$ dotnet add package Microsoft.EntityFrameworkCore.Design

answered Feb 6, 2021 at 22:52

Omar El Hussein's user avatar

4

Some months ago a Visual Studio update broke my capability of running tests. One of the issues was exactly this error. I have the x64 version of the SDK installed but VS tests runner was attempting to use the x86 version. The fix is just changing a setting inside the Test Explorer: Processor Architecture for AnyCPU Projects -> x64.

enter image description here

answered Apr 24, 2020 at 19:34

Matias Beckerle's user avatar

2

It seem to be a known issue for .Net Core installation, github.com/dotnet/core-setup/issues/4350

I have to uninstall all .Net Core packages, both x64 and x86, then reinstalled .Net Core x86 package. And that solved the problem.

answered Dec 13, 2018 at 19:57

wltz's user avatar

wltzwltz

5911 gold badge9 silver badges22 bronze badges

4

This error also happened to me, and the answer I found was very easy, =>
in my solution I had two projects and a class library, the data folder was in the API project, in the case of Migration, I set the default project to the API and I got the same error, but the answer: I just set the API project as the startup project and tried again. The issue was gone.

Have fun.
Shahab Attarnejad

Roly's user avatar

Roly

2,1002 gold badges19 silver badges33 bronze badges

answered May 16, 2022 at 11:22

Shahab Attarnejad's user avatar

Can you change .csproj to add RunCommand like below:

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <Prefer32Bit>false</Prefer32Bit>
    <PlatformTarget>x86</PlatformTarget>
    <Optimize>false</Optimize>
    <RunCommand Condition="'$(PlatformTarget)' == 'x86'">$(MSBuildProgramFiles32)dotnetdotnet</RunCommand>
    <RunCommand Condition="'$(PlatformTarget)' == 'x64'">$(ProgramW6432)dotnetdotnet</RunCommand>
  </PropertyGroup>

</Project>

Maybe you need to add 2 line of RunCommand and update the correct path of dotnet on your laptop.

This issue happens when you are on windows 64bit and run x86 application.

answered Dec 13, 2018 at 4:02

Khai Nguyen's user avatar

Khai NguyenKhai Nguyen

9175 silver badges17 bronze badges

2

For me, I just verified that all the projects in the solution is of same Target framework version. Once that was done, the issue was fixed.

You could view the Target framework version by right clicking a project (*.csproj) and go to properties.
enter image description here

answered May 13, 2022 at 10:39

Roshith S's user avatar

When I got this error just now, it turned out that I need to run an update on Visual Studio.

Close your project window, open the Visual Studio Installer, and run the update.

answered Jun 7, 2022 at 19:58

QualitySurprise's user avatar

If you have this issue in 2022. @Khai Nguyen answer worked for me.

HelloWorld.csproj

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp6.0</TargetFramework>
    <ImplicitUsings>disable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

</Project>

I changed the <TargetFramework>netcoreapp5.0</TargetFramework>

to

<TargetFramework>netcoreapp6.0</TargetFramework>

Since, 6.0 was already installed.

answered Jul 13, 2022 at 2:55

Aditya Rajgor's user avatar

  • Visual Studio 2022 v17.3.6
  • WSL with dotnet 6.0.1 (in Ubuntu) and 6.0.10 (on Windows)
  • testEnvironments.json

"Testhost process exited with error: It was not possible to find any compatible framework version"

I needed to enalbe the Remote Testing install option in the Test Options:

Remote Testing Option

answered Nov 8, 2022 at 14:14

Michael Blake's user avatar

Michael BlakeMichael Blake

1,9892 gold badges17 silver badges31 bronze badges

Alright, this is such BS! Why the H can’t Microsoft get a rollout right. Roll it out right or roll it back!

Anyways — here’s what I had to do to fix this garbage.

1: I had to uninstall all of the .net Core items in the «Programs» section of the control panel.
2: I went to https://github.com/dotnet/core/blob/master/release-notes/download-archive.md and got «2.0 sdk and 2.0 runtime» and installed that.
3: I ran my migration and got the same error as above but the version it was complaining about was «2.0» — SO, I added «2.0.0» to my project and the stupid thing worked.

I hope this works for any one of you — I worked hard enough on this project just to have a «Botched Rollout» reduce it to smoke!

Oh, and another thing — my «data» project borked because the file «.EntityFrameworkCore.targets» was not cleared before it was overwritten. I had 2 ending nodes at the bottom of the file. I hope they fix THAT too.

(Sorry all, I wasted WAY too much time on this SNAFU and it didn’t have to happen.)

Reading 0.68 minutes Count | 1092 characters
main content | 1. Introduction & Background 2, solution 3, declaration and reference
«.NET startup program error: IT WAS NOT POSSIBLE TO FIND ANY Compatible Framework Version»
editor | SCscHero Write time | 2021/12/18 PM11:37
Article type | Series Degree of completion | Completed
motto Every great career has a slight start.

I. Introduction & BackgroundCompletion: 100%

a) respond to problems

When you start the .NET program, you have encountered the following error:

It was not possible to find any compatible framework version 
The framework' Microsof t. AspNetCore. App,version' 2.2.0'' (x64) was not found.
The following frameworks were found:
2. 1.30 at [c: Program Files dotnet sharedMicrosof t. AspNetCore. App]
3. 1. 18 at [C: Program Files dotnet sharedMicrosoft. AspNetCore. App
5.0.9 at [C: Program Files dotnet shared Microsof t. AspNe tCore. App
6.0.0 rc.1.21452.15 at [C: Program Files dotnet sharedMi crosof t. AspNetCore. App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at: 
https:// aka. ms/ dotnet -core-applaunch?framework=Microsof t. AspNetCore. App&framework version=2. 2. O&arch=x64&rid=win10-x64
C: Program Files dotnet dotnet. exe (process 8432) exited with code 2147450730.
To automatically close the console when debugging stops, enable Tools >0ptions- >Debugging >Automatically close the console when debugging stops.
Press any key to close this window...

b) Application scenario

  • It is common to use multiple .NET development framework versions in the project, such as use .Net core3.1, .Net core2.2, .net framework4.7, etc., multiple SDKs.
  • Frequently in multi-project multi-developed scenes launched scenes.

Second, the solutionCompletion: 100%

a) Step 1: Check if the development framework component is installed

Tools -> Get Tools and Features … -> Individual Component tab.

b) Step 2: Download SDK

If you still don’t work after step 1 installation, you need to download SDK separately. The link is:https://dotnet.microsoft.com/en-us/download。

At present, Microsoft pushes the unified version of .NET6, so some entrances may not be obvious, organized as follows:

  • .NET5 / 6 & .NET CORE Download Link:https://dotnet.microsoft.com/en-us/download/dotnet
  • .NET Framework SDK Download Link:https://dotnet.microsoft.com/en-us/download/dotnet-framework

Third, statement and referenceCompletion: 100%

Original blog post, do not reprint without permission.

Welcome to help, welcome you, collect, and pay attention. If you have any questions, please comment on your message! If you need to contact your blogger, you can directly blog private letter SCSChero.

Scenario & Error

Is Microsoft going to end support for the Web API developed using .Net Core 2.1by Aug 21? We planned to migrate it to .Net Core 3.1 and successfully migrated it. We were able to run the application in the local machine using Visual Studio IDE and manually package uploading in AWS Lambda, which  worked well. But the automation build & deployment are getting failed with the below error,

It was not possible to find any compatible framework version
The framework ‘Microsoft.NETCore.App’, version ‘2.1.0’ was not found.
The following frameworks were found:
3.1.15 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Fix applied

  1. .NET code does not contain any error. All migration code was done well.
  2. The root cause of the issue lies in the Circle CI configuration file (YAML).
  3. At step “Install Serverless CLI” build pipeline run the below command,

    dotnet tool install —global Amazon.Lambda.Tools —version 3.1

  4. The command installs the Tool ‘amazon.lambda.tools’ (version ‘3.1.0’)
  5. However, this version of Amazon.Lambda.Tools have a strong dependency on .NETCoreApp 2.1. see below screenshot

The framework 'Microsoft.NETCore.App', version '2.1.0' was not found.

So, at a later step, when the command “dotnet lambda package —configuration release —framework netcoreapp3.1 —output-package bin/release/netcoreapp3.1/deploy-package.zip” is run, the AWS tool is unable to complete the command as it could not find the missing dependency of NETCoreApp 2.1.

As we are upgrading the code from .NET core 2.1 to .NET core 3.1, we cannot downgrade to NETCoreApp 2.1. Finally, after changing the command to “dotnet tool install —global Amazon.Lambda.Tools”, which makes sure the latest version (5.1.2) is installed. This version of the Amazon.Lambda.Tools package has no dependencies and deployment goes smooth fixing the problem.

The framework 'Microsoft.NETCore.App', version '2.1.0' was not found.

Yaml File snap for ref

Before Fix

The framework 'Microsoft.NETCore.App', version '2.1.0' was not found.

The framework 'Microsoft.NETCore.App', version '2.1.0' was not found.

After Fix

The framework 'Microsoft.NETCore.App', version '2.1.0' was not found.

У меня есть приложение ASP.Net Core MVC 2.2. Запуск приложения в Visual Studio работает нормально. Однако, когда я пытаюсь опубликовать приложение с помощью публикации в сети Dotnet , я получаю следующую ошибку:

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 Filesdotnet
    - 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 FilesdotnetsharedMicrosoft.NETCore.App]
        2.1.5 at [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
        2.1.6 at [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
        2.1.7 at [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
        2.1.8 at [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
        2.1.9 at [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
        2.2.2 at [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
        2.2.3 at [C:Program FilesdotnetsharedMicrosoft.NETCore.App]

Я не понимаю, где может быть ссылка на V 1.0.0, вот вывод 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 Filesdotnetsdk2.2.105

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

.NET Core SDKs installed:
  2.1.202 [C:Program Filesdotnetsdk]
  2.1.403 [C:Program Filesdotnetsdk]
  2.1.500 [C:Program Filesdotnetsdk]
  2.1.502 [C:Program Filesdotnetsdk]
  2.1.503 [C:Program Filesdotnetsdk]
  2.1.504 [C:Program Filesdotnetsdk]
  2.1.505 [C:Program Filesdotnetsdk]
  2.2.104 [C:Program Filesdotnetsdk]
  2.2.105 [C:Program Filesdotnetsdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.5 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.6 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.7 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.9 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.2 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.5 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.6 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.7 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.9 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.2 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.9 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
  Microsoft.NETCore.App 2.1.7 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
  Microsoft.NETCore.App 2.1.9 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
  Microsoft.NETCore.App 2.2.2 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]

Файл global.json не используется, файл * .csproj выглядит следующим образом:

<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.Applicationa17e.Application.csproj" />
    <ProjectReference Include="..a17e.EntityFrameworkCorea17e.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="wwwrootcssviewsaccount" />
  </ItemGroup>

</Project>

2 ответа

Лучший ответ

Я думаю, что проблема исходит от вашего PrepublishScript (dotnet bundle). Пакет BundlerMinifier.Core (версия 2.9.406) имеет зависимости от:

  • .NETCoreApp1.0
  • .NETCoreApp2.0
  • .NETFramework4.5.2
  • .NETStandard2.0

Кажется, поскольку проект нацелен на netcoreapp2.2, эта ссылка не работает и либо фактически возвращается к netcoreapp1.0, либо просто вводит в заблуждение сообщение. Для проверки работоспособности, возможно, понизьте проект до netcoreapp2.0, чтобы проверить, работает он или нет.

Просто примечание, netcoreapp2.2 реализует netstandard2.0, поэтому я ожидаю, что это будет работать для всех, но возможно, что вывод не происходит во время разрешения зависимости.


2

Pete Garafano
26 Мар 2019 в 15:24

Решение состояло в том, что у меня была старая версия BundlerMinifier. Ссылка на ядро — изменение, которое решило проблему:

<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.9.406" />

Я также нашел описание ошибки: https://github.com/madskristensen/BundlerMinifier/issues/292


2

Tobias Schittkowski
26 Мар 2019 в 15:18

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • It rained in evening где ошибка
  • Is undergoing maintenance ошибка