NAnt 构建脚本的结构和构建服务器上的解决方案结构

发布于 2024-08-10 12:11:36 字数 1141 浏览 2 评论 0原文

我们正在简化/自动化构建、集成、单元测试以及部署。 我们的软件是在 Visual Studio 中开发的,我们在项目中使用了 C# 和 VB.NET。单个项目可以包含在多个解决方案中(即 Utils 项目在 ProductA 和 ProductB 解决方案中使用)

由于历史原因,我们的代码存储库的结构并不像人们所希望的那样好。 例如,Utils 项目可能位于 ProductA 解决方案下(因为这是它第一次使用的地方),但后来被认为对 ProductB 开发有用,只是包含在 ProductB 的解决方案中(但仍然位于 ProductA 的子目录中)。

我想使用持续集成测试,并设置了一个 CC.NET 构建服务器,我打算在其中使用 NAnt 来创建实际的构建。

问题 1:我应该如何在构建服务器上构建我的构建?我是否应该指示 CC.NET 将 ProductB 的所有项目检索到单个库中,例如类似于的文件结构,

-ProductB
--Utils
--BetterUtils
--Data

或者我应该选择与此类似的文件结构

-ProductA
--Utils

-ProductB
--BetterUtils
--Data

,然后让 NAnt 构建脚本处理引用?我们在 VS 中的引用与代码存储库中的实际位置不匹配,因此今天不可能仅签出 ProductB 解决方案并立即构建它(不幸的是)。我希望这个问题有意义吗?

问题2:是否最好将位于不同项目中的所有源代码检出到单个文件夹中(同时保留某种结构),然后一次构建所有内容或在CC中拥有多个项目.NET 然后让 CC.NET 服务器处理依赖关系? 例子: 当 Utils 项目从未单独发布时,我是否应该在 CC.NET 中有一个单独的项目来监视 Utils 项目的自动构建/测试?或者我应该在将其构建为 ProductB 的一部分的同时构建/测试它?

我希望上述内容有意义,并且您可以为我提供一些使用任一选项的论据。我们离理想的源代码存储库结构还很远,我更希望能够解决构建服务器上存储库结构缺乏的问题,而不必清理存储库的结构。 (不幸的是)放弃 VSS 不是一个选择。

现在,我们的构建包括通过 VS clickonce 进行部署或按 F5,因此自动化构建对我们来说将是一个巨大的进步。

谢谢

We're in the process of streamlining/automating build, integration and unit testing as well as deployment.
Our software is developed in Visual Studio where we have use both C# and VB.NET in our projects. A single project can be contained within multiple solutions (i.e. Utils project is used in both ProductA and ProductB solutions)

For historical reasons our code repository isn't as well structured as one could have hoped for.
E.g. Utils project might be located under ProductA solution (because that's were it was first used) but it was later deemed useful for productB development and merely just included into the solution of productB (but still located in a subdirectory of productA).

I would like to use continous integration testing and have setup a CC.NET build server where I intend to use NAnt for creating the actual builds.

Question 1: How should I structure my builds on the buildserver? Should I instruct CC.NET to retrieve all the projects for productB into a single library e.g. a file structure similar to

-ProductB
--Utils
--BetterUtils
--Data

or should I opt for a filestructure similar to this

-ProductA
--Utils

-ProductB
--BetterUtils
--Data

and then just have the NAnt build scripts handle the references? Our references in VS doesn't match the actual location in the code repository so it's not possible today to just check-out productB solution and build it straight away (unfortunately). I hope this question makes sense?

Question 2: Is it better to check out all the source code located in different projects into a single file folder (whilst retaining some kind of structure) and then build every thing at once or have multiple projects in CC.NET and then let the CC.NET server handle dependencies?
Example:
Should I have a seperate project in CC.NET for monitoring the automated build/test of Utils project when it's never released on it's own? Or should I just build/test it whilst building it as part of ProductB?

I hope the above makes sense and that you can provide me with some arguments for using either option. We're nowhere near an ideal source code repository structure and I would prefer if I can resolve the lack of repository structure on the build server instead of having to clean up the structure of our repository.
Switching away from VSS is (unfortunately) not an option.

Right now our build consists of either deploying via VS clickonce or pressing F5 so just getting the build automated would be a huge step up for us.

Thanks

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

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

发布评论

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

评论(1

无风消散 2024-08-17 12:11:36

为了回答您的第一个问题,我建议为每个构建项目使用单独的顶级文件夹。使用一棵树与源存储库匹配的问题是,当构建服务器尝试同时运行多个构建时,一个或多个构建可能会由于其他进程正在使用文件而失败。此外,您可能会遇到构建脚本拉取旧版本代码的情况。在这种情况下,您不希望其他项目意外地使用不正确的源版本。

如果您的解决方案已经从相对路径引用项目,则最终可能会得到如下结构:

-CCNetBuilds
--ProductASource
---Utils
---...
--ProductBSource
---ProductA
----Utils
---ProductB
----BetterUtils
----Data

在这种情况下,产品 B 的构建包含产品 A 源的一部分,与您的解决方案已预期的相对路径相同。在 CC.Net 中设置这需要更多时间,但如果开发人员在他们的计算机上以这种方式设置代码,则维护起来会更容易。构建服务器使用开发中使用的相同解决方案文件。

为了回答你的第二个问题,我更喜欢实用程序是它自己的构建。如果我对实用程序程序集进行单元测试,我不希望它们为使用实用程序的每个产品运行。另外,如果您有单独的实用程序构建,则可以在 CC.Net 中设置依赖关系,以便在实用程序构建损坏时产品 A 和 B 不会尝试构建。这可以更快地反馈出现问题的情况。

To answer your first question, I would recommend a separate top-level folder for each build project. The problem with having a single tree matching your source repository is that when your build server is trying to run multiple builds at once, one or more will likely fail due to files in use by other processes. Also, you may run into cases where a build script is pulling an older version of the code. In that instance you don't want a different project to accidentally use the incorrect source version.

If your solutions already reference projects from relative paths, you may end up with a structure like this:

-CCNetBuilds
--ProductASource
---Utils
---...
--ProductBSource
---ProductA
----Utils
---ProductB
----BetterUtils
----Data

In this case, the build for Product B contains part of the Product A source, at the same relative path as your solution already expects. This takes a bit more time to set up in CC.Net, but makes it easier to maintain if the developers have their code set up this way on their machines. The same solution files used in development are used by the build server.

To answer your second question, I prefer Utilities being its own build. If I have unit tests on my Utilities assembly, I would not want them to run for every single product that uses the Utilities. Also, if you have a separate build for Utilities, you can set a dependency in CC.Net so that Product A and B will not attempt to build if the Utilities build is broken. This provides a bit faster feedback that something is wrong.

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