简体   繁体   English

.NET 核心应用发布失败

[英].NET Core application publish fail

My .NET Core 3.1 application stopped publishing suddenly and display the below error,我的 .NET Core 3.1 应用程序突然停止发布并显示以下错误,

It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '1.0.0' was not found.
- The following frameworks were found:
  2.1.15 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  2.2.8 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  3.1.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Below is the dotnet --info output下面是dotnet --info output

Version:   3.1.101

Runtime Environment:
OS Name:     Windows
OS Version:  10.0.18363
OS Platform: Windows
RID:         win10-x64
Base Path:   C:\Program Files\dotnet\sdk\3.1.101\

Host (useful for support):
Version: 3.1.1

.NET Core SDKs installed:
2.2.207 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.15 [C:\Program 
Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.15 [\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.15 [\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.1 [\Microsoft.WindowsDesktop.App]

Any idea why this is happening?知道为什么会这样吗?

Your application is targeting .NET Core 1.0, but it's not installed.您的应用程序的目标是 .NET Core 1.0,但尚未安装。

You have 2.1, 2.2 and 3.1 installed, but not 1.0, that your application needs.您安装了应用程序需要的 2.1、2.2 和 3.1,但没有安装 1.0。

You need to install .NET Core 1.0.您需要安装 .NET Core 1.0。

1.0 has been out of support for years and is missing critical fixes. 1.0 多年来一直不受支持,并且缺少关键修复。 You should think about upgrading this application to a supported .NET or .NET Core release.您应该考虑将此应用程序升级到受支持的 .NET 或 .NET 核心版本。

Found the issue.发现问题。 In my case, it was the dotnet bundle PrePublishScript command.就我而言,它是 dotnet bundle PrePublishScript 命令。

<Exec Command="dotnet bundle" />

removing above from my.csproj worked.从 my.csproj 中删除上面的工作。 Not sure why it happened suddenly without even changing the.csproj file.不知道为什么它突然发生甚至没有更改 .csproj 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM