3

我们有一些仅在某些环境中使用的项目,所以我想发布以跳过它们。但是,在发布整个解决方案时,我收到以下 msbuild 错误:

"C:\Source\Solution.sln" (default target) (1) ->
"C:\Source\Project\Project.csproj" (default target) (51) ->
(ValidatePublishProfileSettings target) ->
  C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4253,5): error : The value for PublishProfile is set to 'Sta
ge', expected to find the file at 'C:\Source\Project\Properties\PublishProfiles\Stage.pubxml' but it could not be found. [C:\Source\Project\Project.csproj]
  C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4260,4): error : PublishProfile(Stage) is set. But the $(Web
PublishMethod) does not have a valid value.  Current Value is "". [C:\Source\Project\Project.csproj]
  C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4267,5): error : Target ValidatePublishProfileSettings Faile
d [C:\Source\Project\Project.csproj]

发布解决方案时有什么方法可以忽略该项目,以免出现构建错误?

4

1 回答 1

2

我会去:

  1. 自定义构建脚本(为您要发布的每个项目单独调用 msbuild )(我的首选选项,因此它为您提供了更大的灵活性)
  2. 一个自定义 .sln 文件,其中仅包含发布所需的项目(更简单的选项,但更难维护)

    3.只是一个疯狂的猜测(从来没有尝试过这个部署,但应该根据我的理解工作) -如果您可以为单独的部署计划创建单独的解决方案配置, 您可以尝试使用Build -> Configuration ManagerVS 中的对话框取消选中某些项目的构建复选框:配置管理器

于 2014-06-23T22:35:59.657 回答