最近遇到编译发布的问题,以前也没怎么写过,对是用别人写的去编译,现在自己动手,感觉蛮有趣的!
VS2005:这个的话就简单多了,同样是两个项目,稍微不同的是,前台WEB项目和后台WEB管理项目
C8.bat
@echo off
set FrameworkPath=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
set NAntPath=D:\Build2010\Tools\nant-0.85-bin\nant-0.85\bin
set NunitPath=D:\Build2010\Tools\NUnit-2.4.8-net-2.0\bin
set FxCopPath=D:\Build2010\Tools\Microsoft FxCop 1.36
set path=%path%;%NAntPath%;% NunitPath %;% FxCopPath %;% FrameworkPath %
nant -buildfile:C8.build > C8.log
看到不同了吧 ,开始调用的就有了区别!
C8.build
<?xml version="1.0" encoding="gb2312"?>
<!--
Create by : Phil
Create date : 2008-7-31
Description : 这个Build文件编译WEB层,执行内容为:
1、清空服务器上文件
2、编译解决方案文件
3、拷贝文件到服务器
4、执行FxCop
5、生成XML结果
-->
<project name="Trunk" default="Run">
<target name="Run">
<call target="CleanServer"/>
<call target="CleanOutPut" />
<call target="Checkout"/>
<call target="Compiles" />
<!--
<call target="FxCop" />
-->
<call target="CopyToServer" />
</target>
<!--
*************************************
Configuration properties start.
*************************************
-->
<!--
Determine that if the files of local or server will be deleted.
True is yes, false is not.
-->
<property name="IsCleanServer" value="false"/>
<!-- SourceSafe -->
<property name="VSS.UserName" value="soso"/>
<property name="VSS.Password" value="sosotest"/>
<property name="VSS.DB" value="z:\C8VssDB\srcsafe.ini"/>
<property name="VSS.Path" value="$/C8/C8_New"/>
<!-- LocalBuildFolders -->
<property name="BasePath" value="D:\Build2010\"/>
<property name="SourcePath" value="${BasePath}\Source\C8_New"/>
<property name="OutputPath" value="${BasePath}\Output\C8_New\Chiming.Admin.Web"/>
<property name="OutputBinPath" value="${OutputPath}\bin" />
<property name="OutputPath1" value="${BasePath}\Output\C8_New\Chiming.Web"/>
<property name="OutputBinPath1" value="${OutputPath1}\bin" />
<!--Solution-->
<property name="Solution.Filename" value="${SourcePath}\\C8_New.sln" />
<property name="Solution.Configuration" value="DEBUG" />
<property name="Build.OutputFolder" value="${OutputBinPath}"/>
<property name="ReferBinPath" value="${SourcePath}\bin" />
<!--
Server path. If property "IsCleanServer" is signed "true", files in this path will be delete.
Just be careful!!!!!!
-->
<property name="ServerPath" value="D:\Build2010\Publish\C8_New\" />
<target name="CleanServer" if="${IsCleanServer}">
<delete>
<fileset basedir="${ServerPath}" defaultexcludes="false">
<include name="**" />
<exclude name="*.config" />
<exclude name="aspnet_client/**" />
<exclude name="eWebEditor/**" />
<exclude name="UploadFile/**" />
<exclude name="XG_Log/**" />
</fileset>
</delete>
</target>
<target name="CleanOutPut" if="${IsCleanServer}">
<delete>
<fileset basedir="${OutputPath}" defaultexcludes="false">
<include name="**" />
</fileset>
</delete>
<delete>
<fileset basedir="${OutputPath1}" defaultexcludes="false">
<include name="**" />
</fileset>
</delete>
</target>
<!--Get files from VSS -->
<target name="Checkout" description="Get the latest files from VSS">
<vssget
username="${VSS.UserName}"
password="${VSS.Password}"
localpath="${SourcePath}"
recursive="true"
replace="true"
writable="true"
dbpath="${VSS.DB}"
path="${VSS.Path}"
filetimestamp="Updated"
/>
</target>
<!-- Combination of all compile targets. -->
<target name="Compiles">
<exec program="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msbuild.exe" commandline="${SourcePath}\C8_New.sln" />
<!-- Copy aspx files to output folder -->
<copy todir="${OutputPath}">
<fileset basedir="${SourcePath}\Chiming.Admin.Web">
<include name="**" />
<!-- Files do not be copyed. -->
<exclude name="web.config" />
<exclude name="**\*.cs" />
<exclude name="**\*.resx" />
<exclude name="**\*.csproj" />
<exclude name="**\*.csproj.webinfo" />
<exclude name="**\*.sln" />
<exclude name="**\*.bak" />
<exclude name="**\*.vsdisco" />
<exclude name="**\*.scc" />
<!--<exclude name="**\*.asp" /> -->
<exclude name="**\*.rpt" />
<exclude name="**\*.xsd" />
<exclude name="**\*.xsx" />
<exclude name="**\*.vspscc" />
<exclude name="**\*.user" />
<exclude name="**\*.pdb" />
<exclude name="**\*user" />
</fileset>
</copy>
<copy todir="${OutputPath1}">
<fileset basedir="${SourcePath}\Chiming.Web">
<include name="**" />
<!-- Files do not be copyed. -->
<exclude name="web.config" />
<exclude name="**\*.cs" />
<exclude name="**\*.resx" />
<exclude name="**\*.csproj" />
<exclude name="**\*.csproj.webinfo" />
<exclude name="**\*.sln" />
<exclude name="**\*.bak" />
<exclude name="**\*.vsdisco" />
<exclude name="**\*.scc" />
<!--<exclude name="**\*.asp" /> -->
<exclude name="**\*.rpt" />
<exclude name="**\*.xsd" />
<exclude name="**\*.xsx" />
<exclude name="**\*.vspscc" />
<exclude name="**\*.user" />
<exclude name="**\*.pdb" />
<exclude name="**\*user" />
</fileset>
</copy>
</target>
<!-- fxcop Code Checking -->
<target name="FxCop">
<exec program="fxcopcmd" commandline="${FxCopCommandLine}" />
</target>
<!--
Copy files to server.
-->
<target name="CopyToServer">
<copy todir="${ServerPath}">
<fileset basedir="${OutputPath}">
<include name="**/*" />
<exclude name="**\*user" />
</fileset>
</copy>
<copy todir="${ServerPath}">
<fileset basedir="${OutputPath1}">
<include name="**/*" />
<exclude name="**\*user" />
</fileset>
</copy>
</target>
</project>
这个就这么简单,不在多说了!
同样有个日志文件C8.log
E:\Build\Tools\nant-0.85-rc2\bin 这个就不好怎么弄了!