我如何以及为什么要设置 C# 构建机器? [英] How and why do I set up a C# build machine?

查看:26
本文介绍了我如何以及为什么要设置 C# 构建机器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与一个小型(4 人)开发团队合作开发 C# 项目.我建议设置一台构建机器,它将在夜间构建和测试项目,因为我知道这是一件好事.问题是,我们这里没有很多预算,所以我必须证明这笔费用的合理性.所以我想知道:

I'm working with a small (4 person) development team on a C# project. I've proposed setting up a build machine which will do nightly builds and tests of the project, because I understand that this is a Good Thing. Trouble is, we don't have a whole lot of budget here, so I have to justify the expense to the powers that be. So I want to know:

  • 我需要什么样的工具/许可证?现在,我们使用 Visual Studio 和 Smart Assembly 进行构建,并使用 Perforce 进行源代码控制.我是否需要其他东西,或者是否有相当于运行自动化脚本的 cron 作业?
  • 除了表明构建已损坏之外,这究竟会带给我什么?我是否应该在此解决方案(sln 文件)中设置将由这些脚本运行的测试项目,以便我可以测试特定的功能?目前,我们有两个这样的测试,因为我们没有时间(或者坦率地说,没有经验)进行良好的单元测试.
  • 为此我需要什么样的硬件?
  • 一旦构建完成并经过测试,将构建放在 ftp 站点上或通过其他方式进行内部访问是一种常见的做法吗?这个想法是这台机器制作构建,我们都去它,但如果我们需要,可以进行调试构建.
  • 我们应该多久进行一次这种构建?
  • 如何管理空间?如果我们每晚进行构建,我们应该保留所有旧构建,还是在大约一周左右后开始放弃它们?
  • 还有什么我在这里没有看到的吗?

  • What kind of tools/licenses will I need? Right now, we use Visual Studio and Smart Assembly to build, and Perforce for source control. Will I need something else, or is there an equivalent of a cron job for running automated scripts?
  • What, exactly, will this get me, other than an indication of a broken build? Should I set up test projects in this solution (sln file) that will be run by these scripts, so I can have particular functions tested? We have, at the moment, two such tests, because we haven't had the time (or frankly, the experience) to make good unit tests.
  • What kind of hardware will I need for this?
  • Once a build has been finished and tested, is it a common practice to put that build up on an ftp site or have some other way for internal access? The idea is that this machine makes the build, and we all go to it, but can make debug builds if we have to.
  • How often should we make this kind of build?
  • How is space managed? If we make nightly builds, should we keep around all the old builds, or start to ditch them after about a week or so?
  • Is there anything else I'm not seeing here?

    我意识到这是一个非常大的话题,我才刚刚开始.我在这里找不到这个问题的副本,如果有一本我应该得到的书,请告诉我.

    I realize that this is a very large topic, and I'm just starting out. I couldn't find a duplicate of this question here, and if there's a book out there I should just get, please let me know.

    我终于让它工作了!Hudson 非常棒,FxCop 表明我们认为已实现的某些功能实际上并不完整.我们还必须将安装程序类型从 Old-And-Busted vdproj 更改为 New Hotness WiX.

    I finally got it to work! Hudson is completely fantastic, and FxCop is showing that some features we thought were implemented were actually incomplete. We also had to change the installer type from Old-And-Busted vdproj to New Hotness WiX.

    基本上,对于那些正在关注的人来说,如果您可以从命令行运行您的构建,那么您就可以将其放入 hudson.通过 MSBuild 从命令行运行构建本身就是一个有用的练习,因为它强制您的工具是最新的.

    Basically, for those who are paying attention, if you can run your build from the command line, then you can put it into hudson. Making the build run from the command line via MSBuild is a useful exercise in itself, because it forces your tools to be current.

    推荐答案

    更新:Jenkins 是最新版本的 Hudson.现在每个人都应该使用 Jenkins.我会相应地更新链接.

    Update: Jenkins is the most up to date version of Hudson. Everyone should be using Jenkins now. I'll be updating the links accordingly.

    Hudson 是免费且非常容易配置,并且很容易在虚拟机上运行.

    Hudson is free and extremely easy to configure and will easily run on a VM.

    部分来自我的旧帖子:

    我们用它

    • 部署 Windows 服务
    • 部署网络服务
    • 运行 MSTests &显示与任何 junit 测试一样多的信息
    • 跟踪低、中、高任务
    • 趋势图警告和错误

    以下是 Hudson 支持的一些内置 .net 内容

    Here are some of the built in .net stuff that Hudson supports

    另外,上帝保佑你使用的是visual source safe,它支持那也是.我建议你看看 Redsolo 的关于使用 Hudson 构建 .net 项目的文章

    Also, god forbid you are using visual source safe, it supports that as well. I'd recommend you take a look at Redsolo's article on building .net projects using Hudson

    您的问题

    • :我需要什么样的工具/许可证?现在,我们使用 Visual Studio 和 Smart Assembly 进行构建,并使用 Perforce 进行源代码控制.我是否需要其他东西,或者是否有相当于运行自动化脚本的 cron 作业?

    • Q: What kind of tools/licenses will I need? Right now, we use Visual Studio and Smart Assembly to build, and Perforce for source control. Will I need something else, or is there an equivalent of a cron job for running automated scripts?

    答:我刚刚在运行全新的、已打补丁的 Windows 服务器操作系统的 VM 的全新副本上安装了 Visual Studio.所以你需要许可证来处理它.Hudson 将自身安装为 Windows 服务并在端口 8080 上运行,您将配置您希望它扫描代码存储库以获取更新代码的频率,或者您可以告诉它在特定时间构建.所有可通过浏览器配置.

    A: I just installed visual studio on a fresh copy of a VM running a fresh, patched, install of a windows server OS. So you'd need the licenses to handle that. Hudson will install itself as a windows service and run on port 8080 and you will configure how often you want it to scan your code repository for updated code, or you can tell it to build at a certain time. All configurable through the browser.

    问:除了表明构建已损坏之外,这究竟会给我带来什么?我是否应该在此解决方案(sln 文件)中设置将由这些脚本运行的测试项目,以便我可以测试特定的功能?目前,我们有两个这样的测试,因为我们没有时间(或者坦率地说,没有经验)进行良好的单元测试.

    Q: What, exactly, will this get me, other than an indication of a broken build? Should I set up test projects in this solution (sln file) that will be run by these scripts, so I can have particular functions tested? We have, at the moment, two such tests, because we haven't had the time (or frankly, the experience) to make good unit tests.

    答:您会在第一次构建失败或变得不稳定时收到一封电子邮件.如果单元测试失败或者可以通过您设置的任意数量的标准将其标记为不稳定,则构建是不稳定的.当单元测试或构建失败时,您将收到电子邮件,它会告诉您失败的位置、原因和方式.通过我的配置,我们得到:

    A: You will get an email on the first time a build fails, or becomes unstable. A build is unstable if a unit test fails or it can be marked unstable through any number of criteria that you set. When a unit test or build fails you will be emailed and it will tell you where, why and how it failed. With my configuration, we get:

    • 自上次工作构建以来的所有提交列表
    • 提交这些提交的注释
    • 提交中更改的文件列表
    • 构建本身的控制台输出,显示错误或测试失败

    问:为此我需要什么样的硬件?

    Q: What kind of hardware will I need for this?

    答:一个虚拟机就足够了

    问: 构建完成并经过测试后,将构建放在 ftp 站点上或通过其他方式进行内部访问是一种常见做法吗?这个想法是这台机器进行构建,我们都去它,但如果我们需要,可以进行调试构建.

    Q: Once a build has been finished and tested, is it a common practice to put that build up on an ftp site or have some other way for internal access? The idea is that this machine makes the build, and we all go to it, but can make debug builds if we have to.

    答: Hudson 可以用它做任何您想做的事情,包括通过 md5 哈希对其进行 ID、上传、复制、存档等.它会自动执行此操作并为您提供具有长期的构建工件历史.

    A: Hudson can do whatever you want with it, that includes ID'ing it via the md5 hash, uploading it, copying it, archiving it, etc. It does this automatically and provides you with a long running history of build artifacts.

    问:我们应该多久进行一次这种构建?

    Q: How often should we make this kind of build?

    答:我们每小时轮询一次 SVN,查找代码更改,然后运行构建.Nightly 还可以,但 IMO 有点无用,因为你昨天所做的事情在你早上进来时不会在你的脑海中浮现.

    A: We have ours poll SVN every hour, looking for code changes, then running a build. Nightly is ok, but somewhat worthless IMO since what you've worked on yesterday wont be fresh in your mind in the morning when you get in.

    问:如何管理空间?如果我们每晚进行构建,我们应该保留所有旧构建,还是在大约一周左右后开始抛弃它们?

    Q: How is space managed? If we make nightly builds, should we keep around all the old builds, or start to ditch them after about a week or so?

    答:这取决于您,经过这么长时间,我将我们的构建工件移至长期存储或删除它们,但存储在文本文件/xml 文件中的所有数据我都保留,这让我可以在服务器上存储更改日志、趋势图等,而消耗的空间很小.您也可以将 Hudson 设置为仅保留来自尾随构建数量的工件

    A: Thats up to you, after so long I move our build artifacts to long term storage or delete them, but all the data which is stored in text files / xml files I keep around, this lets me store the changelog, trend graphs, etc on the server with verrrry little space consumed. Also you can set Hudson up to only keep artifacts from a trailing # of builds

    问:还有什么我没有看到的吗?

    Q: Is there anything else I'm not seeing here?

    答:不,现在就去找 Hudson,你不会失望的!

    A: No, Go get Hudson right now, you wont be disappointed!

    这篇关于我如何以及为什么要设置 C# 构建机器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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