gpt4 book ai didi

.net-core - 使用 MSBuild 2022 发布配置文件不起作用

转载 作者:行者123 更新时间:2023-12-05 05:41:19 26 4
gpt4 key购买 nike

MsBuild.exe MyProject.csproj/p:Configuration=Release/p:DebugType=None/p:Optimize=True/p:DeployOnBuild=true/p:PublishProfile=MyPublishProfile/p:VisualStudioVersion=16.0"

我们曾经使用 MsBuild.exe 运行上面的命令来构建和发布 webapp。每当我们使用与 VS 2019 一起打包的 MsBuild 时,它都可以正常工作。路径:C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin

但是,一旦我们使用 VS2022 附带的 MsBuild,它只是编译项目而不是发布。

谁能提供一些说明,为什么在使用 MsBuild VS 2022 运行上述命令时发布不起作用?

注意:该项目的目标是 .Net Framework 4.7。

最佳答案

此链接告诉您 MSBuild 17.0 随 Visual Studio 2022 和 .NET 6.0 一起提供。 https://learn.microsoft.com/en-us/visualstudio/msbuild/whats-new-msbuild-17-0?view=vs-2019

您可以引用以下链接解决问题:首先,在命令行工具中输入“msbuild -ver”,查看msbuild的版本。

enter image description here

然后将命令“/p:VisualStudioVersion=16.0”更改为“/p:VisualStudioVersion=17.2.1”。

它在我的测试中有效。

enter image description here

关于.net-core - 使用 MSBuild 2022 发布配置文件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72296486/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com