您的位置:首页 > 运维架构

IoC/AOP实践之CastleProject编译

2010-04-17 12:19 459 查看
Castle project是非常优秀的开源项目,我们耳熟能详的至少有ActiveRecord和MonoRail(可惜MS 的MVC出来以后没什么市场了).

项目主页: http://www.castleproject.org/

 

为了降低项目开发中的代码耦合性,暂时使用Castle project中的Windsor和AspectSharp来实现IoC/AOP。

IoC介绍: http://zh.wikipedia.org/zh-cn/%E6%8E%A7%E5%88%B6%E5%8F%8D%E8%BD%AC

AOP介绍:http://zh.wikipedia.org/zh-cn/AOP

下载源代码:http://sourceforge.net/projects/castle/

 

 

编译CastleProject需要解决比较多的项目依赖性问题:

NANT构建环境:http://nant.sourceforge.net/ 

Antlr语言解析器:http://www.antlr.org/

Log4Net和NLog:http://logging.apache.org/log4net/index.html

NUnit:单元测试:http://www.nunit.org/

最重要的是需要.NET framework 2.0 SDK

 

1.将下载的Castle Project源代码解压,把需要的nunit.framework/antlr/log4net/等拷贝到ShareLib/net下。设置环境变量,Path中增加NANT的bin目录。

2.根据需要,对build文件进行适当的修改,将default.build中的fileset修改为:

<fileset id="buildfiles.all">
<!-- Files have to be in dependency order -->
<include name="Core/core.build" />
<!-- <include name="Services/services.build" /> -->
<include name="Tools/Tools.build" />
<include name="InversionOfControl/InversionOfControl.build" />
<!-- 		<include name="Components/components.build"  -->/>
<!--
<include name="ActiveRecord/activerecord.build" />
<include name="MonoRail/monorail.build" />
-->
<include name="AspectSharp/aspectsharp.build" />

<include name="Facilities/facilities.build" />
</fileset>


既:不构建Components/ActiveRecord/MonoRail

 

3.Cmd模式下:

构建Debug版本:

nant -D:common.testrunner.enabled=false

 

构建Release版本:

nant -D:common.testrunner.enabled=false -buildfile:release.build  package-net-2.0

 

 

至此构建成功,下一篇文章将讲述如何配置Windsor+AspectSharp

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息