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

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

问题描述

我正在与一个C#项目的小(4人)开发团队合作。我建议设置一个构建机器,它将每晚构建和测试项目,因为我明白这是一个好东西。麻烦的是,我们在这里没有很多的预算,所以我必须为这些权力的费用辩解。所以我想知道:




  • 我需要什么样的工具/许可证?现在,我们使用Visual Studio和Smart Assembly来构建,并使用Perforce进行源代码管理。我需要别的东西,或者有相当于一个cron作业运行自动化脚本?
  • 究竟是什么,这会给我,除了一个坏的建设的迹象?我应该在这个解决方案(sln文件)中设置将由这些脚本运行的测试项目,所以我可以测试特定的功能吗?我们目前有两个这样的测试,因为我们没有时间(或坦率地说,经验)来做好的单元测试。
  • 我需要什么样的硬件?
  • 一旦构建完成并经过测试,将这种构建放在ftp站点上或者以其他方式进行内部访问是一种常见做法吗?这个想法是,这个机器使 生成,我们都去,但是如果我们有可以做调试生成。

  • 我们应该多久是什么样的构建?
  • 如何管理空间?如果我们做夜间建造,我们应该保持所有的旧建筑,或开始沟通他们约一个星期左右?
  • 我还没有看到这里吗?



    我意识到这是一个非常大的主题,我刚刚开始。我在这里找不到这个问题的重复,如果有一本书,我应该得到,请让我知道。



    编辑:我终于得到了上班! Hudson是完美的,FxCop显示,我们认为实现的一些功能实际上是不完整的。我们还必须将安装程序类型从Old-And-Busted vdproj更改为New Hotness WiX。



    基本上,对于那些关注的人,如果你可以运行你的构建从命令行,然后你可以把它放到哈德森。

    解决方案

    通过MSBuild从命令行运行构建本身是一个有用的练习。 >更新: Jenkins 是Hudson的最新版本。每个人都应该使用Jenkins。我将更新相应的链接。



    Hudson 是免费的,非常容易配置,并且很容易在VM上运行。



    我的一个旧帖子:



    我们用它




    • 部署Windows服务

    • 部署网络服务

    • 运行MSTests&

    • 追踪低,中,高任务

    • 趋势图警告和错误



    以下是Hudson支持的一些内置.NET。





    此外,上帝禁止您使用视频源安全,它支持井。我建议您查看 Redsolo's使用Hudson建立.net专案的文章



    您的问题




    • Q :我需要什么样的工具/许可证?现在,我们使用Visual Studio和Smart Assembly来构建,并使用Perforce进行源代码管理。


    • A:我刚刚安装了自动化脚本运行新鲜,修补,安装Windows服务器操作系统的VM的新副本上的视觉工作室。所以你需要许可证来处理。 Hudson将自己安装为一个Windows服务并在端口8080上运行,并且您将配置您希望它扫描代码存储库以更新代码的频率,或者可以让它在特定时间生成。


    • 问:确切地说,这会给我带来什么, ?我应该在这个解决方案(sln文件)中设置将由这些脚本运行的测试项目,所以我可以测试特定的功能吗?我们现在有两个这样的测试,因为我们没有时间(或坦率地说,经验)做好的单元测试。



      A:您将在第一次构建失败或变得不稳定时收到电子邮件。如果单元测试失败或者可以通过您设置的任何数量的条件将其标记为不稳定,则构建不稳定。当一个单元测试或构建失败,你将被发送电子邮件,它会告诉你在哪里,为什么和如何失败。使用我的配置,我们得到:




      • 自上次工作版本以来的所有提交列表

      • 这些提交的注释

      • 提交中更改的文件列表

      • 从构建本身输出的控制台显示错误或测试失败


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



      答:一个虚拟机就足够了


    • 问:已经完成和测试,是一个常见的做法是把它建立在ftp站点或有其他方式进行内部访问?这个想法是,这台机器做的,我们都去,但是如果我们可以做调试生成。



      A: Hudson可以做任何你想要的,包括ID通过md5哈希,上传,复制,归档等等。它自动执行,并为您提供了一个长时间运行的构建工件的历史。

      答:我们每小时都有我们的调查SVN,查找代码更改,然后运行构建。晚上是确定的,但有点没有价值的海事组织,因为你在昨天工作不会在你的头脑清晨在你进来时。


    • 问:如何管理空间?如果我们每晚做一个建筑,我们应该保留所有的老建筑,或者在大约一个星期左右后开始放弃它们?



      A:这是你的,在这么长的时间我将我们的构建工件移动到长期存储或删除它,但所有的数据存储在文本文件/ xml文件我保持,这让我存储更改日志,趋势图等在服务器上用verrrry消耗很少的空间。


    • 问:我还有其他的东西吗?

      b $ b

    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:

  • 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.

    EDIT: 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.

    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.

    解决方案

    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 is free and extremely easy to configure and will easily run on a VM.

    Partly from an old post of mine:

    We use it to

    • Deploy Windows services
    • Deploy web services
    • Run MSTests & display as much information as any junit tests
    • Keep track of low,med,high tasks
    • trendgraph warnings and errors

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

    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

    Your questions

    • 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?

    • 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.

    • 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:

      • list of all commits since the last working build
      • commit notes of those commits
      • list of files changed in the commits
      • console output from the build itself, showing the error or test failure
    • Q: What kind of hardware will I need for this?

      A: A VM will suffice

    • 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.

      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?

      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?

      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?

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

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

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