当前位置: 首页 > news >正文

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

首先声明:我是个刚开始学习使用,哪里不合理还请专家们多指导。

我的实践是这样的,我一台电脑是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做改造,完成发布的时候配置文件替换等操作,敬请您关注,谢谢.......


相关文章:

  • 续接上篇 cc.net 自动发布web应用程序 配置文件的替换
  • 敏捷开发,持续集成 fxcop 在 CruiseControl.NET中的使用
  • 前++和后++的实现
  • 函数的调用规则(__cdecl,__stdcall,__fastcall,__pascal)
  • __declspec关键字详细用法
  • 关于C#间接继承的一些思考:如何修改继承函数的返回值类型
  • 谈谈小弟最近暗自干些什么勾当(LGame WP版开发进度汇报)
  • VC++多线程编程
  • 恐怖绝伦,SOPA和PIPA捅了网站窝!
  • 过年收拾旧货,散点Java游戏源码
  • 面向概念编程浅谈:最大限度的UI代码共用
  • C#实现字符串相似度比较[Levenshtein Distance算法]
  • windows下编译boost库
  • 创建和使用动态链接库
  • boost.python的基本使用方法
  • 【腾讯Bugly干货分享】从0到1打造直播 App
  • bootstrap创建登录注册页面
  • emacs初体验
  • python大佬养成计划----difflib模块
  • Python学习之路16-使用API
  • REST架构的思考
  • 彻底搞懂浏览器Event-loop
  • 深度解析利用ES6进行Promise封装总结
  • 使用parted解决大于2T的磁盘分区
  • 通过获取异步加载JS文件进度实现一个canvas环形loading图
  • 移动端唤起键盘时取消position:fixed定位
  • 译米田引理
  • 译自由幺半群
  • #每日一题合集#牛客JZ23-JZ33
  • (1)(1.13) SiK无线电高级配置(六)
  • (python)数据结构---字典
  • (超详细)语音信号处理之特征提取
  • (免费领源码)Java#ssm#MySQL 创意商城03663-计算机毕业设计项目选题推荐
  • (实战)静默dbca安装创建数据库 --参数说明+举例
  • (详细版)Vary: Scaling up the Vision Vocabulary for Large Vision-Language Models
  • (终章)[图像识别]13.OpenCV案例 自定义训练集分类器物体检测
  • ******IT公司面试题汇总+优秀技术博客汇总
  • ***测试-HTTP方法
  • ..回顾17,展望18
  • .bat批处理(五):遍历指定目录下资源文件并更新
  • .NET 8 中引入新的 IHostedLifecycleService 接口 实现定时任务
  • .NET Core使用NPOI导出复杂,美观的Excel详解
  • .Net mvc总结
  • .net用HTML开发怎么调试,如何使用ASP.NET MVC在调试中查看控制器生成的html?
  • .php文件都打不开,打不开php文件怎么办
  • @staticmethod和@classmethod的作用与区别
  • [04]Web前端进阶—JS伪数组
  • [23] GaussianAvatars: Photorealistic Head Avatars with Rigged 3D Gaussians
  • [Android]使用Retrofit进行网络请求
  • [APIO2015]巴厘岛的雕塑
  • [AUTOSAR][诊断管理][ECU][$37] 请求退出传输。终止数据传输的(上传/下载)
  • [bzoj1324]Exca王者之剑_最小割
  • [C++]类和对象【上篇】
  • [C++核心编程](四):类和对象——封装
  • [ffmpeg] 定制滤波器