首页 > 解决方案 > 如何定位特定的 .NET 核心版本

问题描述

在我的开发机器上,我安装了 .NET core 5.0.5、5.0.6 和 5.07 托管包。在我的产品机器上,我有 .NET core 5.0.5

在我的 .csproj 文件中,我有:

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <RuntimeFrameworkVersion>5.0.5</RuntimeFrameworkVersion>
    <Version>1.0.0</Version>
    <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
    <OutputType>WinExe</OutputType>
    <EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
  </PropertyGroup>

我使用 VS2019 构建。

部署到生产后,我在事件查看器中得到以下信息:

Could not find 'aspnetcorev2_inprocess.dll'. Exception message:
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.7' was not found.
  - The following frameworks were found:
      2.1.15 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      3.1.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      5.0.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

显然我不想使用 5.0.7 我做错了什么?

标签: .netasp.net-coreasp.net-core-5.0

解决方案


错误在 .NET5 中得到确认,据说在 .NET6 中已修复 https://github.com/dotnet/aspnetcore/issues/33941


推荐阅读