dotnet发布命令似乎忽略了框架参数
我正在尝试构建和发布 .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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论