【问题标题】:NANT, Cruise Control and ASP.net 4.0NANT、巡航控制和 ASP.net 4.0
【发布时间】:2010-10-08 09:53:30
【问题描述】:

有没有人知道 NANT.Build 文件和 CCNet.Config 文件条目的基本示例的好资源,用于在 ASP.net 4.0 应用程序上进行夜间构建,在线浏览了一下,似乎有一个关于如何做到这一点有很多猜想,但我正在寻找可持续的东西。

我有使用 .Net 2.0、.Net 3.5 和 .Net 4.0 的项目,它们都需要通过带有 Nant 的 Cruise Control 进行夜间构建,因此每个项目都需要单独配置,而不仅仅是为 .Net 配置 Cruise Control 4.0,所以我在这里寻找最佳实践。

【问题讨论】:

    标签: cruisecontrol.net nant asp.net-4.0 nightly-build


    【解决方案1】:

    如果您在构建机器上安装了 Visual Studio,则可以采用以下方法。我过去几乎所有事情都使用 NANT 和 MSBUILD,但是当我们升级框架时,我厌倦了破解它。

    我用 Nant 和 CC.Net 做配置管理已经有一段时间了。根据我的经验,我不建议使用 Nant MSBuild 任务,而是最简单的方法是创建任务,创建任务执行的 .bat 文件。推荐使用命令行 Visual Studio 的原因有很多,其中一个原因是 MSI 包不容易使用 Nant 构建,即使您使用 contrib。这种方式更容易,也更快。

    .bat file with this
    ---------2.0 ------------- "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv" C:\YourProject\YourSoultion.sln /Rebuild release
    
    ----------3.5-------------- "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv" C:\YourProject\YourSoultion.sln /Rebuild release
    
    similar logic for 4.0
    

    这里有很多关于 ccnet 任务的信息 http://ccnet.sourceforge.net/CCNET/Configuring%20the%20Server.html

    ccnet 配置示例

        <tasks>
              <nant>
                <executable>C:\Nant\Nant0.86\bin\nant.exe</executable>
                <baseDirectory>.</baseDirectory>
                <buildFile>C:\NANT_SCRIPTS\build.xml</buildFile>
                <targetList>
                  <target>DexWeb</target>
                </targetList>
                <buildTimeoutSeconds>2000</buildTimeoutSeconds>
              </nant>       
     </tasks>
        build.xml
        <target name="DexWeb">
            <exec program="C:\NANT_SCRIPTS\continous\dexbuild.bat" />
          </target> 
    

    【讨论】:

    • 既然可以直接&lt;exec/&gt;devenv.exe,为什么还要使用.bat文件?
    • 我试图记住我为什么使用 .bat 文件,如果我没记错的话,那是因为我们使用的 NANT 版本没有正确解析路径中的空格,即使你使用了转义序列和或引用。现在可以解决了,只是习惯而已。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-10
    • 1970-01-01
    • 2015-11-10
    • 1970-01-01
    • 2012-08-11
    相关资源
    最近更新 更多