0

我在 Team Foundation Server 项目中有文件夹和文件,在更改和签入时,需要将其部署到构建服务器上的文件夹中。没有解决方案或项目文件。

我对 MSBuild 不是很熟悉,所以我为 TeamCity 中的 VS2012 项目制作了一个工作 build.xml,对其进行了编辑,以便它可以复制文件,但在 TeamCity 获取最新源后没有任何反应。

我在 build.xml 中做错了什么?

<?xml version="1.0" encoding="utf-8" ?>
 <Project DefaultTargets="Copy" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Target Name="Copy">
      <Copy SourceFiles="@(PackagedFiles)" 
            DestinationFiles="@(PackagedFiles->'\\SomeFolder\CredentialOnline\%(RecursiveDir)%(Filename)%(Extension)')"/>
 </Target> 
</Project>  
4

2 回答 2

0
<?xml version="1.0" encoding="utf-8" ?>
<Project DefaultTargets="CopyToDeployFolder" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="CopyToDeployFolder">
    <Exec Command="echo D| xcopy.exe  $(teamcity_build_checkoutDir) c:\Someplace /s /Y"  />

  </Target>
 </Project>  
于 2013-10-03T18:34:58.510 回答
0

下面将让您“微调”您想要的文件。如果您不想排除任何内容,只需删除“Exclude=" 子句即可。

仅供参考: WorkingDir 是一个自定义变量,即我的“根目录”。

<ItemGroup>
    <MyExcludeFiles Include="$(WorkingDir)\**\SuperSecretStuff.txt" />
    <MyExcludeFiles Include="$(WorkingDir)\**\SuperSecretStuff.doc" />
</ItemGroup>

<ItemGroup>
    <MyIncludeFiles Include="$(WorkingDir)\**\*.*" Exclude="@(MyExcludeFiles)"/>
</ItemGroup>        



<Copy
SourceFiles="@(MyIncludeFiles)"
DestinationFiles="@(MyIncludeFiles->'$(OutputDir)\%(RecursiveDir)%(Filename)%(Extension)')"
/> 

您的“PackagedFiles”中可能没有任何内容。这是一种列出它们的方法。

<Message Text="List of files using special characters (carriage return)"/>
<Message Text="@(PackagedFiles->'&quot;%(fullpath)&quot;' , '%0D%0A')"/>
<Message Text="   "/>
<Message Text="   "/>
于 2013-10-03T20:42:47.867 回答