如何配置 TeamCity 以动态构建项目而不是导出项目?

发布于 2024-12-29 18:09:51 字数 741 浏览 0 评论 0原文

我有一个测试解决方案 (TestSolutionA),其中包含一个测试项目 (TestProjectA:包含 NUnit 的系统测试),并引用另一个现有项目 (ProjectB),因为我的测试项目需要读取该项目的一些类,例如 EmailHelper 。

TFS 中的文件夹结构:

*Root
**Tests
***References
***TestSolutionA
****TestProjectA
**ClassLibraries
***ProjectB

References 文件夹包含 TestProjectA 使用的程序集,例如 NUnit.dll 等。

现在我已经配置了 TeamCity,以便它构建 TestSolutionA 并运行 TestProjectA 的测试。这意味着,当构建 TestSolutionA 时,此解决方案中引用的所有文件和文件夹都将检出到“检出目录”,然后构建解决方案。

问题是这个测试解决方案构建速度很慢,因为每次它都必须将 ProjectB 的所有文件和文件夹检出/导出到 TeamCity 服务器并重建它们,而只需要 ProjectB 的 dll,而不需要所有文件/类其中有哪些。

当涉及的外部项目越多时,这个问题就越明显。

在测试项目必须引用外部项目的情况下,是否有更好的解决方案来加快构建速度?例如,动态构建程序集,而不是检查它们/将它们导出到 TeamCity 服务器。

不确定这是否可能。

希望问题清楚。

谢谢,

I have a test solution (TestSolutionA) which contains a test project (TestProjectA: containing system tests with NUnit) and have a reference to another existing project (ProjectB) since my test project needs to read some of the classes of that project such as EmailHelper.

Folder structure in TFS:

*Root
**Tests
***References
***TestSolutionA
****TestProjectA
**ClassLibraries
***ProjectB

The References folder contains assemblies such as NUnit.dll, etc which are used by the TestProjectA.

Now I have configured TeamCity so that it builds the TestSolutionA and runs the tests of the TestProjectA. This means that when the TestSolutionA is built, all the files and folders which have been referenced in this solution are checked out to a "Check Out Directory" and then the solution builds.

The problem is that this test solution is slow to build because each time it has to check out/export all the files and folders of the ProjectB to the TeamCity Server and rebuild them whereas only the dll of the ProjectB is required not all files/classes which are in it.

The problem appears more when more external projects are involved.

Would there be any better solution to speed up the build in such scenarios where a test project has to reference external projects? e.g. building the assembly on the fly rather than checking them out/exporting them to the TeamCity Server.

Not sure it's possible.

Hope the question is clear.

Thanks,

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

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

发布评论

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

评论(1

多彩岁月 2025-01-05 18:09:51

您需要做的是为 ProjectB 创建一个单独的 TeamCity 构建配置,用于构建 DLL 并将其作为工件发布。然后,您可以配置 TestSolution 构建配置,使其具有对 ProjectB DLL 的工件依赖性。这样,您的 TestSolution 构建配置根本不必提取 ProjectB 的任何源代码。

TeamCity 文档中的一些有用链接包括:

http://confluence.jetbrains.net/display/ TCD65/Build+Artifact

http://confluence.jetbrains.net/display/TCD65/Artifact+Dependencies

What you need to do is to create a separate TeamCity build configuration for ProjectB that builds the DLL and publishes it as an artifact. You can then configure the TestSolution build configuration so that it has an artifact dependency on the ProjectB DLL. This way your TestSolution build configuration won't have to pull any source code for ProjectB at all.

Some useful links in the TeamCity documentation are:

http://confluence.jetbrains.net/display/TCD65/Build+Artifact

http://confluence.jetbrains.net/display/TCD65/Artifact+Dependencies

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