我還創建了一個自動化的構建過程,並作爲執行「乾淨」的一部分獲得,即重命名當前的本地工作文件夾,然後在執行完整之前將文件從tfs重新獲取到工作文件夾的乾淨副本構建和單元測試。我在單獨的文件夾中使用Nant腳本,因此不能只更改目錄(更改Nant中的當前目錄對此問題不起作用)。我的解決方案是創建並運行批處理文件。下面的示例腳本南特:
<!--do a clean get to the solution folder-->
<target name="clean_get">
<!--Create the batch file-->
<property name ="batch.file" value="clean_get.bat" />
<echo file="${batch.file}" append="True">md ${workfolder.path}</echo>
<echo file="${batch.file}" append="True">${environment::newline()}cd ${workfolder.path}</echo>
<echo file="${batch.file}" append="True">${environment::newline()}tf get $/${project.name} /recursive</echo>
<!--Run the batch file-->
<exec program="clean_get.bat" >
</exec>
<!--Delete the batch file - we're done with it-->
<delete file="${batch.file}" failonerror="false" />