dotnet发布命令似乎忽略了框架参数

发布于 2025-01-19 15:28:44 字数 1106 浏览 2 评论 0原文

我正在尝试构建和发布 .NET Framework 4.7.2 项目。构建工作正常,但尝试发布时出现以下错误:

C:\Program Files\dotnet\sdk\6.0.201\Microsoft.Common.CurrentVersion.targets(4466,5): error : MSB4803: The task "FormatUrl" is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild. See https://aka.ms/msbuild/MSB4803 for further details. [C:\Users\ethanseal\Documents\compute-hybridrp\src\EV2Linter\EV2Linter.csproj]
Start-WindowsBuild : Encountered an error during dotnet publish C:\Users\ethanseal\Documents\xxxxxxx\Linter.sln -o
C:\Users\ethanseal\Documents\xxxxxxx\Linter --no-build
At C:\Users\ethanseal\Documents\xxxxxxx\build\build-win.ps1:63 char:1
+ Start-WindowsBuild
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Start-WindowsBuild

这是我使用的命令:

& dotnetpublish $solution -o $outPath -f net472 --no-build

您可以看到我包含了一个参数来指定 .NET Framework 4.7.2 框架。那么为什么它默认为.NET Core 6.0呢?此外,该项目的目标框架为 4.7.2。

I am attempting to build and publish a .NET Framework 4.7.2 project. The build works fine, but attempting to publish gives me the following error:

C:\Program Files\dotnet\sdk\6.0.201\Microsoft.Common.CurrentVersion.targets(4466,5): error : MSB4803: The task "FormatUrl" is not supported on the .NET Core version of MSBuild. Please use the .NET Framework version of MSBuild. See https://aka.ms/msbuild/MSB4803 for further details. [C:\Users\ethanseal\Documents\compute-hybridrp\src\EV2Linter\EV2Linter.csproj]
Start-WindowsBuild : Encountered an error during dotnet publish C:\Users\ethanseal\Documents\xxxxxxx\Linter.sln -o
C:\Users\ethanseal\Documents\xxxxxxx\Linter --no-build
At C:\Users\ethanseal\Documents\xxxxxxx\build\build-win.ps1:63 char:1
+ Start-WindowsBuild
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Start-WindowsBuild

Here's the command I used:

& dotnet publish $solution -o $outPath -f net472 --no-build

You can see that I included an argument to specify the .NET Framework 4.7.2 framework. So why is it defaulting to .NET Core 6.0? Additionally, the project has a target framework of 4.7.2.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文