2013-10-03 58 views
0

我有一個Team Foundation Server項目中的文件夾和文件,在修改和簽入時,需要將其部署到構建服務器上的文件夾中。沒有解決方案或項目文件。MSBuild - 只需複製TeamCity中的文件

我對MSBuild並不熟悉,因此我在TeamCity中爲VS2012項目編寫了一個工作的build.xml文件,對它進行了編輯以便複製文件,但在TeamCitygets最新的源文件後沒有任何反應。

我在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> 
+1

@(PackagedFiles)的內容是什麼?您可以使用Message任務來顯示它,例如'' – stijn

回答

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> 
0

下面將讓你「微調」你想要的文件。 如果您不想排除任何內容,只需刪除「排除=」子句。

供參考: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=" "/>