团队城市MSBuild排除多个文件

时间:2014-11-19 21:49:01

标签: msbuild teamcity

我有以下命令行参数。这是团队城市建设的一步。我需要排除web.config和robots.txt。

/p:DeployOnBuild=True
/p:PublishProfile=OffCycleDevelopmentRemoteDeployment
/p:ProfileTransformWebConfigEnabled=False
/p:VisualStudioVersion=12.0
/p:ExcludeFilesFromDeployment=Web.config;robots.txt

当我尝试"运行"我的构建失败了。该项目。

[15:34:30]Step 1/1: Visual Studio Build and Publish (Visual Studio (sln)) (1s)
[15:34:30][Step 1/1] Starting: C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe /workdir:C:\TeamCity\buildAgent\work\McoMobile-OffCycle "/msbuildPath:C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe"
[15:34:30][Step 1/1] in directory: C:\TeamCity\buildAgent\work\McoMobile-OffCycle
[15:34:31][Step 1/1] MSBuild command line parameters contain "/property:" or "/p:". It is recommended to define System Property on Build Parameters instead.
[15:34:31][Step 1/1] Process exited with code 1
[15:34:31][Step 1/1] MSBuild output
[15:34:31]Start MSBuild...
[15:34:31]'C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe' '"@C:\TeamCity\buildAgent\work\Mobile-OffCycle\Mobile.sln.teamcity.msbuild.tcargs" "C:\TeamCity\buildAgent\work\Mobile-OffCycle\Mobile.sln.teamcity"'
[15:34:31]working dir = 'C:\TeamCity\buildAgent\work\Mobile-OffCycle'
[15:34:31]Microsoft (R) Build Engine version 12.0.30723.0
[15:34:31][Microsoft .NET Framework, version 4.0.30319.18408]
[15:34:31]Copyright (C) Microsoft Corporation. All rights reserved.
[15:34:31]
[15:34:31]MSBUILD : error MSB1006: Property is not valid.
[15:34:31]Switch: robots.txt
[15:34:31]
[15:34:31]For switch syntax, type "MSBuild /help"
[15:34:31][Step 1/1] Step Visual Studio Build and Publish (Visual Studio (sln)) failed

如果我只保留一个文件,则不会发生错误。

/p:ExcludeFilesFromDeployment=Web.config

如何在此处指定多个文件?

我试过以下但这是将我的文件发布到网站上。

/p:ExcludeFilesFromDeployment=Web.config
/p:ExcludeFilesFromDeployment=robots.txt

1 个答案:

答案 0 :(得分:1)

您需要引用属性值,例如/p:ExcludeFilesFromDeployment="Web.config;robots.txt"

如果您需要将属性值转换为项目列表

,请参阅this question

我不确定你在哪里找到属性ExcludeFilesFromDeployment,但我认为它正在运行,并且有一个MSBuild目标来处理预期的行为。