在TeamCity中使用MSBuild复制文件

时间:2011-05-04 08:58:48

标签: msbuild teamcity

我有以下xml文件:

<?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" DefaultTargets="DeployPrototype" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <dotCover>..\..\..\plugins\dotCover\bin\dotCover.exe</dotCover>
      </PropertyGroup>
      <ItemGroup>
        <SourceFiles Include="..\Prototype\Site\Site\Bin\TestServer\Default.html;..\Prototype\Site\Site\Bin\TestServer\Site.xap"/>
        <DestinationFolder Include="C:\inetpub\wwwroot\ProjectName\Prototype"/>
      </ItemGroup>

      <Target Name="Build">
          <MSBuild Projects="../ProjectName.Web.sln" Properties="Configuration=testserver" />
          <Message Text="Building ProjectName solution" Importance="high" />
      </Target>

      <Target Name="TeamCity" DependsOnTargets="Build">
        <Message Text="Before executing MSpec command" Importance="low" />
        <Exec Command="..\packages\Machine.Specifications.0.4.10.0\tools\mspec-clr4.exe ..\Hosts\ProjectName.Hosts.Web.Specs\bin\ProjectName.Hosts.Web.Specs.dll --teamcity" />
        <Message Text="Ran MSpec" Importance="low" />
        <Exec Command="$(dotCover) c TestServerBuildAndRunTestsOnly_DotCover.xml" />
        <Message Text="##teamcity[importData type='dotNetCoverage' tool='dotcover' path='build\coverage.xml']" Importance="high" />
      </Target>

      <Target Name="DeployPrototype" DependsOnTargets="TeamCity">
        <Message Text="Before executing copy, source files are: @(MySourceFiles) and destination folder is: @(DestinationFolder)" Importance="low" />
            <Copy
              SourceFiles="@(MySourceFiles)"
              DestinationFolder="@(DestinationFolder)"
      />
        <Message Text="Atter executing copy" Importance="low" />
      </Target>
    </Project>

此脚本中的所有内容都与复制文件无关。我放入复制部分的消息没有出现在TeamCity的完整日志中。在后者的配置设置中,我将“DeployPrototype”作为我的目标。

为什么没有发生复制操作?

1 个答案:

答案 0 :(得分:6)

对于涉及MSBuild无法在TeamCity下工作的特定问题,答案几乎总是涉及添加/v:d(执行的每个步骤和有关跳过的步骤的信息)或/v:diag({{1}的详细加转储用于诊断目的的等等)到MSBuild args和TeamCity管理的构建输出将有答案。