使用 cc.net 自动发布开发人员作品

发布于 2024-07-19 07:30:06 字数 310 浏览 3 评论 0原文

我想构建一个开发人员构建项目,然后需要将其发布到服务器,成功发布后需要针对该开发人员发布构建我的测试项目。 基本思想是每当任何开发人员在 Svn 上提交某些内容时就运行此过程。

目前我正在使用 CC.net 和 MSBuild。 任何人都知道如何完成这项工作。

步骤 1. 开发人员在 SVN 上提交 步骤 2. 检测 Svn 上的更改并在构建服务器上进行更新 步骤 3. 使用最近的更改构建项目 步骤4.发布到服务器 步骤 5. 然后针对最近的发布运行测试(我使用 cc.net、msbuild 和 nunit 成功完成了此过程)

I want to build a developer build project and then needs to publish it to the server and After a successful publish need to build my test project against that developer publish. Basic idea is to run this process whenever any developer commits something on Svn.

Currently I am using CC.net and MSBuild. Any one ahaving idea how to accomplish this work.

Step 1. Developer commit on SVN
Step 2. Detect Changes on Svn and take an update on Build server
Step 3. Build the project with recent changes
Step 4. Publish it to the server
Step 5. then run tests against the recent publish (I am successfully doing this process by using cc.net, msbuild and nunit)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

绝不放开 2024-07-26 07:30:06

如果您使用“项目”标签,您还可以在“其中”包含其发布者。
例如:

<project >  
 <tasks>  ... 
 </tasks>   
<publishers> 
 <buildpublisher>   
   <sourceDir>path with built binaries</sourceDir>
   <publishDir>path that will be shared</publishDir>
  </buildpublisher> 
 </publishers> 
</project>

if you're using the Project tag, you can also include "in it" the publisher for it.
For example:

<project >  
 <tasks>  ... 
 </tasks>   
<publishers> 
 <buildpublisher>   
   <sourceDir>path with built binaries</sourceDir>
   <publishDir>path that will be shared</publishDir>
  </buildpublisher> 
 </publishers> 
</project>
玻璃人 2024-07-26 07:30:06

无论构建成功还是失败,CC.Net 中的publisher 部分都会被执行。 您需要将“发布到构建服务器”添加为任务,位于任务部分下 - 将其放在最后一个构建步骤之后。

这将导致 CC.Net 仅在所有先前的“任务”完成后才“发布到构建服务器”,而不会引发错误代码。

通常,如果您知道 DOS .bat 文件中需要什么来“发布到构建服务器”,您可以执行以下操作:

<tasks>
    <msbuild>
        <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
        <workingDirectory>c:\Somewhere</workingDirectory>
        <projectFile>Something.sln</projectFile>
        <buildArgs>/noconsolelogger /p:Configuration=Debug /v:m</buildArgs>
        <targets>Build</targets>
        <timeout>720</timeout>
        <logger>C:\program files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
    </msbuild>
    <exec>
        <executable>C:\program files (x86)\CruiseControl.NET\server\PublishToServer.bat</executable>
        <baseDirectory>C:\somewhere</baseDirectory>
        <buildArgs></buildArgs>
        <buildTimeoutSeconds>9000</buildTimeoutSeconds>
    </exec>
</tasks>

正如 slawekg 指出的那样,您可以使用 buildpublisher,它在构建成功时才执行,但是我仍然发现使用批处理文件进行复制比使用 buildpublisher 更可配置。

The publisher section in CC.Net will be executed regardless if the build is successful or fails. You need to add the 'publish to build server' as a task, under the tasks section - putting it after your last build step.

This will cause CC.Net to only 'publish to build server' when all previous 'tasks' are completed, without raising an error code.

Typically, if you know what is needed in a DOS .bat file to 'publish to build server' you do as follows;

<tasks>
    <msbuild>
        <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
        <workingDirectory>c:\Somewhere</workingDirectory>
        <projectFile>Something.sln</projectFile>
        <buildArgs>/noconsolelogger /p:Configuration=Debug /v:m</buildArgs>
        <targets>Build</targets>
        <timeout>720</timeout>
        <logger>C:\program files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
    </msbuild>
    <exec>
        <executable>C:\program files (x86)\CruiseControl.NET\server\PublishToServer.bat</executable>
        <baseDirectory>C:\somewhere</baseDirectory>
        <buildArgs></buildArgs>
        <buildTimeoutSeconds>9000</buildTimeoutSeconds>
    </exec>
</tasks>

As slawekg points out, you can use the buildpublisher, which will execute only if the build is successful, however I still find using a batch file to do the copying more configurable than what is available using buildpublisher.

二智少女猫性小仙女 2024-07-26 07:30:06

您还可以考虑将“推送”写入您的 MS 构建脚本。 这将为您提供 Sam 所说的灵活性和控制力,并且仍然确保仅在构建成功时才进行发布。

You might also consider writing the "push" into your MS Build Script. This would give you the flexibility and control that Sam is talking about and still ensure that the publish only happens if the build succeeds.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文