Nant的高階用法

iDotNetSpace發表於2008-06-25
Nant的高階技巧

 

1,拷貝檔案的方法;

    
        
        
        
    

這段配置的意思是,bin目錄裡面的全部檔案,除了以pdbobj結尾的,都拷貝到release目錄下面,理解也容易.

2,複雜點的編譯配置

     
        
     
     
        
         
         
     
              
 

注意csc裡面多了幾個引數;這裡的${???}是在前面定義好的變數,可以直接引用

** 代表的是當前目錄和所有的子目錄

* 代表的是任何檔案

**/*.cs是說任何在當前目錄下面的cs檔案,這樣就可以讓編譯效率高些,不必要對所有的單個檔案都寫引用了!

Arg標籤,當然是引數了!

3,環境變數

java,等等其他的東西一樣,都要有環境變數

下面是Nant內建的環境變數,不過不知道是什麼版本的了

Table 4.2. Built-in NAnt Properties

Property Name

Explanation

${nant.version}

The version of NAnt.

${nant.filename}

The full path to the NAnt assembly.

${nant.location}

The location of the nant.exe file.

${nant.onsuccess}

Properties to target names that you want executed when the build file is done.

${nant.onfail}

Properties to target names that you want executed when the build file is done.

${nant.project.basedir}

The absolute path of the project's basedir.

${nant.project.buildfile}

The absolute path of the buildfile.

${nant.project.name}

The name of the project.

${nant.project.default}

The name of the project's default target.

${nant.task.*}

Each task available to nant has a "true" value, e.g., nant.task.copy.

${nant.settings.currentframework.frameworkassemblydirectory}

The fully qualified path to the current .NET framework global aasembly cache.

${nant.settings.currentframework.name}

The name of the current .NET framework.

${nant.settings.currentframework.version}

The current .NET framework version.

${nant.settings.currentframework.description}

The description of the current .NET framework.

${nant.settings.currentframework.csharpcompilername}

The C# compiler for the current CLI framework.

${nant.settings.currentframework.resgentoolname}

The resgen tool for the current CLI framework.

${nant.settings.currentframeworkframeworkdirectory}

The fully qualified path to the current .NET framework directory.

${nant.settings.currentframework.runtimeengine}

The runtime engine for the current CLI framework.

${nant.settings.currentframework.sdkdirectory}

The fully qualified path to the current .NET sdk directory.

 

主要是在用的時候在看吧!

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12639172/viewspace-364824/,如需轉載,請註明出處,否則將追究法律責任。

相關文章