CruiseControl.NET svn获取 自动编译 ftp上传

CruiseControl.NET http://www.cruisecontrolnet.org/

下载地址 http://sourceforge.net/projects/ccnet/files/ 有时被墙

配置文件工具,可惜只支持到1.4 http://www.codeplex.com/wikipage?ProjectName=ccnetconfig

ftp task/publisher http://build.sharpdevelop.net/ccnet/doc/CCNET/Ftp%20task%20-%20Publisher.html

CCTray 要进到目录里下 http://sourceforge.net/projects/ccnet/files/CruiseControl.NET%20Releases/CruiseControl.NET%201.8.0/

配好svn服务端

安装CC,CC是否需要和svn服务装到一台机器没有测试,因为在自动获取时需要提供svn服务的exe路径,估计是要在同一机器的

修改CruiseControl.NET 安装目录下server目录中的ccnet.config

   1: <triggers>
   2:     <intervalTrigger
   3:            name="continuous"
   4:            seconds="30"
   5:            buildCondition="IfModificationExists"
   6:            initialSeconds="5"/>
   7: </triggers>

从svn获取

   1: <sourcecontrol type="svn">
   2:     <trunkUrl>https://127.0.0.1/svn/ccweb/trunk/ccWeb</trunkUrl>
   3:     <workingDirectory>F:\cc\cctest</workingDirectory>
   4:     <executable>D:\Program Files\VisualSVN Server\bin\svn.exe</executable>
   5:     <username>admin</username>
   6:     <password>admin</password>
   7:     <autoGetSource>True</autoGetSource>      
   8: </sourcecontrol>

msbuild编译和ftp上传,对于mvc项目来说,一般传bin,content,views,javascript等几个文件夹内的东西就可以了。

web.config一般不会动,如果需要改了,手动上传一下也不费事

   1: <tasks>
   2:     <exec>
   3:         <executable>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
   4:         <baseDirectory>F:\cc\cctest</baseDirectory> 
   5:         <buildArgs>Build.msbuild /p:Configuration=Release</buildArgs>             
   6:     </exec>
   7:     <ftp>
   8:       <serverName>192.168.2.123</serverName>
   9:       <userName>admin</userName>
  10:       <password>123456</password>
  11:       <action>UploadFolder</action>
  12:       <ftpFolderName>/ccweb/bin</ftpFolderName>
  13:       <localFolderName>F:\cc\cctest\ccWeb\bin</localFolderName>
  14:       <recursiveCopy>true</recursiveCopy>
  15:       <timeDifference>1</timeDifference>
  16:     </ftp>
  17:     <ftp>
  18:       <serverName>192.168.2.123</serverName>
  19:       <userName>admin</userName>
  20:       <password>123456</password>
  21:       <action>UploadFolder</action>
  22:       <ftpFolderName>/ccweb/views</ftpFolderName>
  23:       <localFolderName>F:\cc\cctest\ccWeb\views</localFolderName>
  24:       <recursiveCopy>true</recursiveCopy>
  25:       <timeDifference>1</timeDifference>
  26:     </ftp>
  27:     <ftp>
  28:       <serverName>192.168.2.123</serverName>
  29:       <userName>admin</userName>
  30:       <password>123456</password>
  31:       <action>UploadFolder</action>
  32:       <ftpFolderName>/ccweb/content</ftpFolderName>
  33:       <localFolderName>F:\cc\cctest\ccWeb\content</localFolderName>
  34:       <recursiveCopy>true</recursiveCopy>
  35:       <timeDifference>1</timeDifference>
  36:     </ftp>
  37: </tasks>

在baseDirectory中建立Build.msbuild文件

   1: <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
   2:     <Target Name="Build"> 
   3:         <MSBuild Projects="ccWeb.sln" Targets="Clean;Rebuild"/> 
   4:     </Target> 
   5: </Project> 

默认的配置文件,是不支持中文的,如果svn路径里包含中文,需要把配置文件转码

posted @ 2012-08-08 15:46  czcz1024  阅读(398)  评论(0编辑  收藏  举报