Nant的高级用法

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.

 

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

请使用浏览器的分享功能分享到微信等