我有以下xml文件:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="DeployPrototype" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<dotCover>......pluginsdotCoverbindotCover.exe</dotCover>
</PropertyGroup>
<ItemGroup>
<SourceFiles Include="..PrototypeSiteSiteBinTestServerDefault.html;..PrototypeSiteSiteBinTestServerSite.xap"/>
<DestinationFolder Include="C:inetpubwwwrootProjectNamePrototype"/>
</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="..packagesMachine.Specifications.0.4.10.0toolsmspec-clr4.exe ..HostsProjectName.Hosts.Web.SpecsbinProjectName.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='buildcoverage.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"作为我的目标。
为什么没有复制操作?
对于涉及MSBuild在TeamCity下不工作的给定问题,答案几乎总是涉及将/v:d
(执行的每个步骤和有关跳过步骤的信息)或/v:diag
(用于诊断目的的ItemGroup
s等的详细加上转储)添加到MSBuild参数和TeamCity管理的构建输出将有答案。