如何从建筑项目的存储库中为CruiseControl.net设置建筑步骤? [英] How to setup building steps for CruiseControl.net from repository of the building project?

查看:85
本文介绍了如何从建筑项目的存储库中为CruiseControl.net设置建筑步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 ccnet.config 文件(或该项目的其他cc.net配置文件)存储在项目的存储库(git)中并进行CC当我强制从仪表板构建时,.NET使用它。我该怎么做?

I'd like to store ccnet.config file (or other cc.net configuration file for this project) in the repository (git) of my project and make CC.NET use it when I force building from dashboard. How can I do it?

谢谢!

推荐答案

您的 ccnet.config应该保持相当静态。

Your "ccnet.config" should remain fairly static.

如果您在解决方案/项目构建中需要不同的逻辑,那么我建议:

If you need different "logic" for your solution/project building, then I suggest:

1.  Write your ccnet.config code to pull source code from repository. (aka, Task #1)
2.  In your repository, include a MasterBuild.proj (msbuild definition).
3.  Have cc.net call msbuild.exe on MasterBuild.proj (aka, Task #2).
4.  Have the majority of your logic inside the MasterBuild.proj file.  That is what you check in/out of source control.

如果您将CC.NET视为超级精美的msbuild.exe执行程序,

If you think of CC.NET as a "super fancy msbuild.exe executor", you're world will make more sense IMHO.

这是一个非常基本的msbuild(定义)文件。
您可以称之为

Here is a very basic msbuild (definition) file. You can call it

MySolutionMasterBuild.proj(或类似名称)

MySolutionMasterBuild.proj (or similar)

将其放在同一位置目录作为您的.sln文件(在源代码管理中)。

Put this in the same directory as your .sln file (in source control).

使用CC.NET下载代码。
然后连接msbuild.exe来调用以下文件。

Use CC.NET to download the code. Then wire up msbuild.exe to call the below file.

然后,.proj文件中包含任何其他逻辑。

Then have any extra logic inside the .proj file.

您还可以进行其他CC.NET方面的工作,例如后期生成电子邮件和合并任何结果xml,但是大多数逻辑(无论如何我还是很喜欢...)。会在下面的文件中。

You can do some of the other CC.NET stuff, like post build emailing and merging any results xml, but the majority of the logic (my preference anyways)..........would be in the file below.

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="AllTargetsWrapped">
    <PropertyGroup>
        <!-- Always declare some kind of "base directory" and then work off of that in the majority of cases  -->
        <WorkingCheckout>.</WorkingCheckout>
        <ArtifactDestinationFolder>$(WorkingCheckout)\ZZZArtifacts</ArtifactDestinationFolder>
    </PropertyGroup>

    <Target Name="AllTargetsWrapped">

        <CallTarget Targets="CleanArtifactFolder" />
        <CallTarget Targets="BuildItUp" />
        <CallTarget Targets="CopyFilesToArtifactFolder" />

    </Target>


    <Target Name="BuildItUp" >
        <MSBuild Projects="$(WorkingCheckout)\MySolution.sln" Targets="Build" Properties="Configuration=$(Configuration)">
            <Output TaskParameter="TargetOutputs" ItemName="TargetOutputsItemName"/>
        </MSBuild>
        <Message Text="BuildItUp completed" />
    </Target>



    <Target Name="CleanArtifactFolder">


        <RemoveDir Directories="$(ArtifactDestinationFolder)" Condition="Exists($(ArtifactDestinationFolder))"/>

        <MakeDir Directories="$(ArtifactDestinationFolder)" Condition="!Exists($(ArtifactDestinationFolder))"/>

        <Message Text="Cleaning done" />


    </Target>

    <Target Name="CopyFilesToArtifactFolder">

        <ItemGroup>
            <MyExcludeFiles Include="$(WorkingCheckout)\**\*.doesnotexist" />
        </ItemGroup>

        <ItemGroup>
            <MyIncludeFiles Include="$(WorkingCheckout)\bin\$(Configuration)\**\*.*" Exclude="@(MyExcludeFiles)"/>
        </ItemGroup>        


        <Copy
                SourceFiles="@(MyIncludeFiles)"
                DestinationFiles="@(MyIncludeFiles->'$(ArtifactDestinationFolder)\%(Filename)%(Extension)')"
        />

    </Target>

</Project>

这篇关于如何从建筑项目的存储库中为CruiseControl.net设置建筑步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆