使用nant编译项目
来源:互联网 发布:2010年韩国进出口数据 编辑:程序博客网 时间:2024/05/29 15:35
1.拷贝tools,build.bat,nant.build,nuget.install.bat到项目路径下
2.修改nant.build文件,编写web站点生成脚本
代码如下:
<?xml version="1.0"?>
<project name="wf" default="build">
<property name="project.config" value="Release" dynamic="true" />
<!--path-->
<property name="dir" value="."/>
<property name="dir.tools" value=".\external-tools"/>
<property name="build.base" value="build\${project.config}"/>
<property name="build.absolutepath" value="${path::get-full-path(build.base)}" />
<property name="xpath.flag" value="/configuration/appSettings/add[@key='EnvironmentVersionFlag']/@value"/>
<property name="xpath.entrance" value="/configuration/appSettings/add[@key='AppDomainLoaderEntrance']/@value"/>
<!--msbuild-->
<property name="msbuild" value="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" />
<property name="msbuild.config" value="Debug" dynamic="true"/>
<if test="${project.config=='Release'}">
<property name="msbuild.config" value="Release"/>
</if>
<property name="msbuild.params"
value="/t:rebuild
/p:Configuration=${msbuild.config}
/t:ResolveReferences" />
<property name="msbuild.params.weboutput" value="/p:WebProjectOutputDir=${build.absolutepath}" />
<property name="msbuild.params.output" value="/p:OutputPath=${build.absolutepath}" />
<!--nuget-->
<property name="nuget" value="${path::get-full-path(dir.tools)}" />
<property name="nuget.packages" value="${dir}\packages" />
<property name="nuget.cache" value="C:\Users\${environment::get-user-name()}\AppData\Local\NuGet\Cache" />
<property name="nuget.install" value="${dir}\nuget.install.bat" />
<property name="nuget.params.install" value="${nuget} ${path::get-full-path(nuget.packages)}" />
<!--wf-->
<property name="wf.app" value="" />
<!--clean-->
<target name="clean" description="clean build folder">
<delete dir="${build.absolutepath}"></delete>
</target>
<!--nuget install and update-->
<target name="nuget" description="nuget install and update">
<delete dir="${nuget.packages}"></delete>
<delete dir="${nuget.cache}"></delete>
<exec program="${nuget.install}"
commandline="${nuget.params.install}"
workingdir="${dir}" />
</target>
<!--build web-->
<target name="promotionweb" description="PromotionWebsite">
<property name="eam_web" value="PromotionWebsite" />
<exec program="${msbuild}"
commandline="${msbuild.params}
${msbuild.params.weboutput}\${eam_web}
${msbuild.params.output}\${eam_web}\bin"
workingdir="${dir}\src\xxx.Web" />
<copy todir="${build.absolutepath}\${eam_web}\bin" overwrite="true">
<fileset basedir="${dir}\src\Assembly\GAC\">
<include name="System.Web.Mvc.dll" />
</fileset>
</copy>
<delete>
<fileset>
<include name="${build.absolutepath}\${eam_web}\*.config" />
</fileset>
</delete>
<if test="${project.config=='Release'}">
<copy todir="${build.absolutepath}\${eam_web}" overwrite="true">
<fileset basedir="${dir}\src\xxx.Web\Config\Release">
<include name="Web.config" />
</fileset>
</copy>
</if>
</target>
</project>
3.通过bat命令辅助修改文件
copy ".\build\Release\xxxWebsite\application_config\Release.properties.config" ".\build\Release\xxxWebsite\application_config\properties.config"
del ".\build\Release\xxxWebsite\application_config\Release.properties.config"
- 使用nant编译项目
- 用 Nant 编译项目
- Nant 使用
- SVN + CruiseControl.NET + NANT 自动编译提交的项目
- 使用NAnt构建入门
- nant的使用
- Nant使用简介
- Nant使用简介续
- 使用Nant入门
- SVN + CruiseControl.NET + NANT 自动编译提交的项目最小DEMO
- NAnt
- Nant
- nant的使用 (复制)
- NAnt与MSBuild使用(一)
- NANT的使用—安装
- nant的使用(二)-基本原理之运行nant
- nant的使用(一)-安装
- nant的使用(二)-基本原理之工程
- html标签总结
- Android apk 的安装过程
- 抛开flash,自己开发实现C++ RTMP直播流播放器
- 神一般的搞定Myeclipse 注册
- 关于opencv在QT下的若干问题总结
- 使用nant编译项目
- 程序员面试宝典-第九章-9.3-面试例题1-函数指针
- Android Webservices 返回多行多列数据(Dataset)
- Js字符串操作函数大全
- php图片不显示时,需要查看是否安装gd库
- Wince线程优先级设定
- Android获得安装或者未安装的apk的信息:versionName, packageName, appIcon...
- Hibernate乐观锁和悲观锁浅析
- 三角形类的构造函数