2010-02-05 22 views
1

我剛剛開始在我們的CruiseControl項目中選取NAnt作爲MSBuild的替代品。NAnt - 在基礎目錄之外的csc任務中包含源文件

我們在一組項目中執行的一件事是從項目樹外部的單個AssemblyInfo.cs文件中鏈接,以使版本更簡單(它位於項目文件夾上方的目錄中)。

<csc>任務的<sources>部分中是否有明顯的方法實現此目的?

從我所知道的情況來看,<sources>部分僅支持單個<include>元素,該元素必須位於任務基礎之下。

我想另一個選擇是在調用csc之前將單個AssemblyInfo.cs文件作爲任務的一部分進行復制,但是想知道是否有更乾淨的方法來做到這一點。

回答

1

<sources/>中,您並不侷限於單個<include/>。您可以參考任何你想要的,如果你不specift的<sources/>basedir屬性:

<csc target="exe" output="HelloWorld.exe" debug="true"> 
    <sources> 
     <!-- Will use project dir as base dir --> 
     <include name="**/*.cs" /> 
     <!-- Absolute path --> 
     <include name="/tmp/42/*.cs" /> 
     <!-- Relative to project dir --> 
     <include name="../../Shared/*.cs" /> 
    </sources> 
    <references> 
     <include name="System.dll" /> 
     <include name="System.Data.dll" /> 
    </references> 
</csc> 
+0

大 - 這樣的作品,謝謝。 – matt 2010-02-05 14:25:46

相關問題