.NET项目构建自动化与南特/的MSBuild + SVN南特、化与、项目、NET

2023-09-04 01:42:05 作者:Forever ° 辰莫

相当长的一段时间了,我一直在试图找出如何建立一个自动化的构建过程,在我们的商店。我看了很多帖子和指南在这个问题上,没有人真的适合我的具体需求。

我的SVN仓库的布局如下:

  \项目
   \了projectA(产品)
       \标签
           \ 1.0.0.1
           \ 1.0.0.2
           ...
       \主干
           \ SRC
              \ proj1(一VS C#项目)
              \ proj2
           \文档
 

然后,我有一个网络共享,有一个文件夹,每个项目(产品),又包含二进制文件,书面文件和生成的API文档(通过NDoc的 - 每一个项目可能在资源库中​​.ndoc文件)对于各个历史版本(从标记的SVN文件夹)和在最新版,以及(从主干的)。

基本上,我想在一个预定的批量构建有以下步骤:

检查项目的SVN文件夹,并确定的标签取值没有present网络共享 对于每个标签 检查出的标记文件夹 建立(与发行版配置) 生成的二进制代码复制到网络共享 搜索.ndoc文件 通过NDoc的生成CHM文件 生成的CHM文件复制到网络共享 请无异于2,但中的最新版本的主干的

现在,麻烦的是,我不知道从哪里开始。我不保持的.sln文件资源库,但我可以用的MSBuild文件,从而打造属于特定产品的C#项目替换这些。

我觉得最麻烦的部分是存储库的考试标签已尚未处理 - 即搜索标签,并将其比作项目的目录结构的网络共享。我不知道该怎么做,在任何的构建工具(楠,MSBuild的)。

能否请您为我提供关于如何处理这个任务作为一个整体和细节,以及一些指点?我不在乎,如果我使用恶性,MSBuild的,或两者兼而有之。我知道这可能是相当复杂的,但每一个想法和恶性/ MSBuild的片断将是一个很大的帮助。

在此先感谢。

解决方案 如何移植.NET Framework项目至.NET Core

在NantContrib有一个SVN命令,你可以用它来获取信息。你可以从SVN命令行中运行的任何查询,你应该能够使用,然后分析结果。所以,你可以做一个标签搜索,匹配的标签的文件夹在你的网络共享,然后执行检出任何正在使用SVN-checkout命令丢失。一旦完成火的MSBuild命令为每个项目文件夹。

如果你想有自动化的另一种构建是创建一个分支,而不是一个标签,因为它看起来像你正在创建的版本VS只是一个标签。如果你创建一个分支,你可以有一个自动构建工具如CruiseControl.net或TeamCity的的监察您的存储库。那么,如果一个文件被签入的分支或主干,你可以把它脱掉你的自动生成。

在这两者之间,你应该能够处理它。如果您想对那些在他们实施(拉链和销售的东西)的文档一些构建脚本一个很好的例子,看看城堡项目位置:的 http://www.castleproject.org/

他们甚至使用一些SVN的命令来获取的东西,如版本号,什么不能自动生成assymbly信息的文件。

for quite a while now, I've been trying to figure out how to setup an automated build process at our shop. I've read many posts and guides on this matter and none of them really fits my specifics needs.

My SVN repository is laid out as follows

\projects
   \projectA (a product)
       \tags
           \1.0.0.1
           \1.0.0.2
           ...
       \trunk
           \src
              \proj1  (a VS C# project)
              \proj2
           \documentation

Then I have a network share, with a folder for each project (product), which in turn contains the binaries, written documentation and the generated API documentation (via NDoc - each project may have an .ndoc file in the repository) for every historical version (from the tags SVN folder) and for the latest version as well (from the trunk).

Basically, what I want to do in a scheduled batch build are these steps:

examine the project's SVN folder and identify tags not present in the network share for each of these tags

check out the tag folder build (with Release config) copy the resulting binaries to the network share search for .ndoc files generate CHM files via NDoc copy the resulting CHM files to the network share

do the same as in 2., but for the HEAD revision of trunk

Now, the trouble is, I have no idea where to start. I do not keep .sln files in the repository, but I am able to replace these with MSBuild files which in turn build the C# projects belonging to the specific product.

I guess the most troubling part is the examination of the repository for tags which have not been processed yet - i.e. searching the tags and comparing them to a project's directory structure on the network share. I have no idea how to do that in any of the build tools (NAnt, MSBuild).

Could you please provide me with some pointers on how to approach this task as a whole and in detail as well? I do not care if I use NAnt, MSBuild, or both. I am aware that this might be rather complex, but every idea and NAnt/MSBuild snippet will be a great help.

Thanks in advance.

解决方案

In NantContrib there is a SVN command you can use to get information. Any query you can run from the SVN command line you should be able to use and then parse the result. So you could do a tag search, match the tags to folders on your network share, then perform a checkout for any that are missing using the svn-checkout command. Once done fire the msbuild command for each project folder.

An alternative if you want to have automated builds would be to create a branch instead of a tag since it looks like you are creating versions vs just a tag. If you create a branch you could have an automated build tool like CruiseControl.net or TeamCity monitory your repository. Then if a file is checked in on the Branch or Trunk you can have it kick off your automated build.

Between the two you should be able to handle it. If you would like a good example of some build scripts that have the documentation implemented in them (with zip and distribution stuff) check out the Castle Project here: http://www.castleproject.org/

They even use some of the SVN commands to get things like the revision number and what not for auto generating the assymbly info files.

 
精彩推荐
图片推荐