找不到任何兼容的框架版本.未找到指定的框架“Microsoft.NETCore.App",版本“2.2.0" [英] It was not possible to find any compatible framework version. The specified framework 'Microsoft.NETCore.App', version '2.2.0' was not found

查看:29
本文介绍了找不到任何兼容的框架版本.未找到指定的框架“Microsoft.NETCore.App",版本“2.2.0"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建并部署了一个 .Net Core 控制台应用程序.

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

项目的平台目标是 x86.

The project's Platform target is x86.

目标框架是 .Net Core 2.2(x86).

Target framework is .Net Core 2.2(x86).

虽然安装了 .Net Core 2.2 (x86) SDK,但在开发人员命令提示符 VS2017 中执行命令 dotnet myapp.dll 后,我收到以下错误.

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]

.Net Core 2.2(x86) SDK 安装在C:Program Files (x86)dotnetshared"路径下,系统环境变量包含C:Program Files (x86)dotnet".

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".

有什么建议吗?谢谢!

~~~更新1

以下是 .csproj 信息的一部分,抱歉无法显示全部内容.

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>

推荐答案

这似乎是 .Net Core 安装的一个已知问题,github.com/dotnet/core-setup/issues/4350

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

我必须卸载所有 .Net Core 包,包括 x64 和 x86,然后重新安装 .Net Core x86 包.这解决了问题.

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

这篇关于找不到任何兼容的框架版本.未找到指定的框架“Microsoft.NETCore.App",版本“2.2.0"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆