MSBuild 忽略发布配置文件配置

MSBuild ignoring publish profile configuration

我正在尝试使用 MSBuild 通过命令行发布一组 Web 服务和一个网站。当我发布时,Web 服务发布成功,但我的网站没有在检查日志时发现,我意识到 msbuild 忽略了指定发布配置文件中的构建配置,并使用默认配置,即 Debug|AnyCpu。我在 SO 和互联网上漫游并找到了一些文章,但 none 对我有用。

Other SO article

我希望能够让 MSBuild 理解我正在尝试通过 publishprofile 进行发布。我测试了发布配置文件和 visual studio 并且能够执行发布。

这是我的 msbuild 命令

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe "PATH_TO_PROJECT\PROJECT.csproj" /nodeReuse:false /nologo /p:PublishProfile="FolderProfile" /p:DeployOnBuild=True

日志

The target "_ConvertPdbFiles" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (34,37)" does not exist in the project, and will be ignored. The target "_CollectPdbFiles" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (34,70)" does not exist in the project, and will be ignored. The target "_CollectMdbFiles" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (41,38)" does not exist in the project, and will be ignored. The target "_CopyMdbFiles" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets (41,71)" does not exist in the project, and will be ignored. Project "C:\Git\DXT\DXT.UI.WEB.APP.DEVICES\Dxt.Web\Dxt.Web.csproj" on node 1 (default targets). C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(609,5): error : The OutputPath property is not set for project 'Dxt.Web.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\Git\DXT\DXT.UI.WEB.APP.DEVICES\Dxt.Web\Dxt.Web.csproj] Done Building Project "C:\Git\DXT\DXT.UI.WEB.APP.DEVICES\Dxt.Web\Dxt.Web.csproj" (default targets) -- FAILED.

Build FAILED.

"C:\Git\DXT\DXT.UI.WEB.APP.DEVICES\Dxt.Web\Dxt.Web.csproj" (default target) (1) -> (_CheckForInvalidConfigurationAndPlatform target) ->
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(609,5): error : The OutputPath property is not set for project 'Dxt.Web.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\Git\DXT\DXT.UI.WEB.APP.DEVICES\Dxt.Web\Dxt.Web.csproj]

0 Warning(s)
1 Error(s)

Time Elapsed 00:00:00.09

我尝试提供特定配置以避免 Debug|AnyCpu 组合,但遇到错误,因为该网站有一个名为 Release.Custom 的自定义配置,并且依赖于没有该配置的项目。

非常感谢任何帮助。

如果有人遇到这个问题,我可以通过将 Configuration 标签的值更改为我的自定义 BuildConfiguration 来修复我的错误,即 "Release.Custom"。考虑到我在这上面花了一天时间,这是非常愚蠢的。