您的位置:首页 > 产品设计 > UI/UE

敏捷开发,持续集成 CruiseControl.NET 自动发布 我的一点小实践 其中配置文件替换部分挺重要

2011-12-30 11:22 645 查看
首先声明:我是个刚开始学习使用,哪里不合理还请专家们多指导。

         我的实践是这样的,我一台电脑是win2003+ii6是可以自动发布到iis的,但是工作时主要用的是xp+ii5的机器,在iis5下总也自动发布不成功,因此我想了一个折中的方法:

现在iis下发布一个应用,在用wdproj把程序生成到之前的那个目录下,采取替换的方式。
          在实践中我觉得一点比较常见,但是国内的博客上很少介绍,但是实际工作中应该会肯定遇到的,就是文件的copy,因为开发环境跟测试环境,生产环境绝对是不同,因此需要配置文件的替换,我的配置文件里也有相关说明,希望给同样是cc.net的初学者以帮助。

      把我的配置文件copy如下:

<project name="WebHelloWorld" webURL="http://localhost/ccnet">
<sourcecontrol type="vss">
<executable>D:\Program Files\Microsoft Visual SourceSafe\SS.EXE</executable>
<project>$/WebHelloWorld</project>
<username>ccnet</username>
<password>ccnet</password>
<ssdir>\\anderslu\andersvss\</ssdir>
<applyLabel>false</applyLabel>
<autoGetSource>true</autoGetSource>
<alwaysGetLatest>false</alwaysGetLatest>
<workingDirectory>E:\testspace\CCnetgroup\WebHelloWorld\code</workingDirectory>
<culture>fr-FR</culture>
<cleanCopy>true</cleanCopy>
<timeout units="minutes">10</timeout>
</sourcecontrol>
<triggers>
<!--60秒触发一次,buildCondition为触发的条件,有ForceBuild及IfModificationExists等条件
<intervalTrigger  seconds="60" buildCondition="ForceBuild" />-->
</triggers>
<tasks>
<exec executable="E:\testspace\CCnetgroup\WebHelloWorld\other\CoverSlnFile.bat" />
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
<workingDirectory>E:\testspace\CCnetgroup\WebHelloWorld\code</workingDirectory>
<projectFile>WebHelloWorld.sln</projectFile>
<buildArgs>/p:Configuration=Debug /v:diag</buildArgs>
<timeout>900</timeout>
<logger>d:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
<targets>Clean;Rebuild</targets>
</msbuild>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
<workingDirectory>E:\testspace\CCnetgroup\WebHelloWorld\WebHelloWorld_deploy</workingDirectory>
<projectFile>WebHelloWorld_deploy.wdproj</projectFile>
<buildArgs>/p:Configuration=Debug /v:diag</buildArgs>
<timeout>900</timeout>
<logger>d:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
<targets>Clean;Rebuild</targets>
</msbuild>
</tasks>
<publishers>
<xmllogger logDir="E:\testspace\CCnetgroup\WebHelloWorld\log" />
<buildpublisher>
<sourceDir>E:\testspace\CCnetgroup\WebHelloWorld\code</sourceDir>
<publishDir>E:\testspace\CCnetgroup\WebHelloWorld\publishDir</publishDir>
<useLabelSubDirectory>false</useLabelSubDirectory>
<alwaysPublish>false</alwaysPublish>
</buildpublisher>
<email mailport="25" includeDetails="TRUE" mailhostUsername="******@qq.com" mailhostPassword="******" useSSL="FALSE">
<from>******@qq.com</from>
<mailhost>smtp.qq.com</mailhost>
<users>
<user name="****" group="teamleader" address="****@qq.com" />
<!--
<user name="******" group="cto" address="****@****.com.cn" />
<user name="****" group="buildmaster" address="****@139.com" />
<user name="****" group="developers" address="*****@qq.com" />
<user name="*****" group="developers" address="********@qq.com" />
-->
</users>
<groups>
<group name="cto">
<notifications>
<notificationType>Success</notificationType>
<notificationType>Fixed</notificationType>
</notifications>
</group>
<group name="teamleader">
<notifications>
<notificationType>Always</notificationType>
</notifications>
</group>
<group name="developers">
<notifications>
<notificationType>Failed</notificationType>
<notificationType>Fixed</notificationType>
</notifications>
</group>
<group name="buildmaster">
<notifications>
<notificationType>Always</notificationType>
</notifications>
</group>
</groups>
<converters>
<regexConverter find="{1}quot; replace="@qq.com" />
</converters>
<modifierNotificationTypes>
<NotificationType>Exception</NotificationType>
<NotificationType>Failed</NotificationType>
<NotificationType>Fixed</NotificationType>
<NotificationType>Success</NotificationType>
</modifierNotificationTypes>
<subjectSettings>
<subject buildResult="StillBroken" value="Build is still broken for {WebHelloWorld}" />
</subjectSettings>
<xslFiles>
<!--邮件里都包还那些内容-->
<file>xsl\header.xsl</file>
<file>xsl\compile.xsl</file>
<file>xsl\unittests.xsl</file>
<file>xsl\modifications.xsl</file>
</xslFiles>
<attachments>
<file>E:\testspace\CCnetgroup\WebHelloWorld\other\AFile.txt</file>
<file>Relative.txt</file>
</attachments>
</email>
</publishers>
</project>




            
<exec executable="E:\testspace\CCnetgroup\WebHelloWorld\other\CoverSlnFile.bat" />文件里执行的是:"Robocopy E:\testspace\CCnetgroup\WebHelloWorld\other\ E:\testspace\CCnetgroup\WebHelloWorld\code\ *.sln"
有关Robocopy的介绍请不了解的百度下。
        因为我不想再程序员那里的解决方案里出现autodeploy项目,因此在服务器端先写好了一个*.sln文件,去替换自动从vss获取的*.sln文件。还有一个问题是我发现build *.sln的时候并不会去执行.wdproj,因此单独写了一个<msbuild>去编译.wdproj,完成发布任务。

        接下来我会在.wdproj做改造,完成发布的时候配置文件替换等操作,敬请您关注,谢谢.......
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐