Build. Net project with Nant

Source: Internet
Author: User

NantIs A. Net build tool, Official Website: http://nant.sourceforge.net/. Nant provides a wide range of APIS, you can easily integrate and deploy. Net projects.

This is an example of deploying an ASP. NET project:

    • Copy files to a specific directory to filter files
    • Copy all files to a specific directory to filter files/folders.
    • Set folder permissions and automatically process "Are you sure? Y/N "tip (see: http://support.microsoft.com/kb/135268)

Operation: Set post-build event command: $ (solutiondir) Build. bat in the project. For details, seeCode:

Build. BAT:

 
C: \ Nant \ bin \ Nant-buildfile :~ Filepath/Nant.BuildEchoY | cacls c: \ temp \ webroot \ gen_files/g <my_user_name>: F

Nant. Build:

 <?  XML version = "1.0"  ?> <  Project  Name  = "Frankweb"  Default  = "Build"  Basedir  = "Frankwebapp"  >      <  Target  Name  = "Build"  >          <  Echo  Message = "Hello, this is Nant build ."   />                  <  Property  Name  = "Dir. Base"  Value  = "$ {Project: Get-base-directory ()}"   />          <  Property  Name  = "Dir. bin"  Value  = "$ {Dir. Base} \ bin"   />         <  Echo  Message  = "The project DIR is :$ {dir. Base }"   />                  <  Property  Name  = "Dir."  Value  = "C: \ temp \ webroot"   />          <  Delete  Dir  = "$ {Dir. }"  />                  <  Property  Name  = "Dir. gen_files"  Value  = "$ {Dir. to} \ gen_files"   />          <  Foreach  Item  = "File"  In  = "$ {Dir. Bin }"  Property  = "File. Name" >              <  Echo  Message  = "The file in Bin :$ {file. name }"   />              <  If  Test  = "$ {Not string: ends-with (file. Name, '. pdb ')}"  >                  <  Copy  File  = "$ {File. name }"  Todir = "$ {Dir. to} \ to_files"   />              </  If  >              <  If  Test  = "$ {String: ends-with (file. Name, '. pdb ')}"  >                  <  Copy  File  = "$ {File. name }"  Todir  = "$ {Dir. gen_files }"  />              </  If  >          </  Foreach  >                  <  Copy  Todir  = "$ {Dir. }"  >              <  Fileset  >                  <  Include Name  = "**/*. Aspx"   />                  <  Include  Name  = "**/*. Cs"   />                  <  Include  Name  = "**/*. Js"   />                  <  Include  Name  = "**/*. CSS"  />                  <  Include  Name  = "**/*. Config"   />                  <  Include  Name  = "**/*. Csproj"   />                  <  Include  Name  = "**/*. Dll"   />                  < Include  Name  = "**/*. PDB"   />                                  <  Exclude  Name  = "**/Obj /**"   />              </  Fileset  >          </  Copy  >      </  Target >  </  Project  > 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.