TFSBuild/MSBuild 和项目参考与文件参考

发布于 2024-08-24 04:05:35 字数 401 浏览 6 评论 0原文

我们有一个使用由 TFS Build 构建的项目引用的大型 VS 解决方案,如下所示:

Solution
- Project 1
- Project 2
- Project ...
- Project N

因为该解决方案太大,所以我们有几个日常使用的较小解决方案:

SubSolution
- Project 1
- Project 19

问题是从事 SubSolution 的开发人员发现它没有构建因为找不到项目引用,所以他们将项目更改为使用文件引用。

然后,这会继续破坏 TFS 构建,它无法找到这些文件引用,因为它们尚未构建(即使项目位于同一解决方案中)。有没有办法解决这两种类型的引用之间的拉锯战?分解解决方案的正确方法是什么?

We Have a large VS solution using project references which is build by TFS Build like so:

Solution
- Project 1
- Project 2
- Project ...
- Project N

Because the solution is too large we have several smaller solutions which we use day to day:

SubSolution
- Project 1
- Project 19

The problem is that developers working on SubSolution find that it is not building because the project references could not be found, so they change the projects to use file references.

This then goes on to break the TFS Build which cannot find these file references because they have not been built yet (Even though the projects are in the same solution). Is there a way around this tug of war between the two types of references. What is the correct way of splitting out your solutions?

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

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

发布评论

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

评论(2

牛↙奶布丁 2024-08-31 04:05:35

分解解决方案的正确方法是什么?

请查看 Patterns & 的 TFS 指南中的本章。实践团队:

第 3 章 - 在源代码管理中构建项目和解决方案

请特别注意“分区解决方案”场景(我相信您实际上正在尝试实现)的注释:

与以前版本的 Visual Studio 不同,Visual Studio 2005 依赖于 MSBuild。现在可以创建不包含所有引用项目的解决方案结构,并且仍然可以正确构建。只要首先构建主解决方案并从每个项目生成二进制输出,MSBuild 就能够遵循解决方案范围之外的项目引用并成功构建。仅当您使用项目引用而不是文件引用时,这才有效。您可以从 Visual Studio 构建命令行和 IDE 成功构建以这种方式创建的解决方案,但默认情况下不能使用 Team Build。为了使用 Team Build 成功构建,请使用包含所有项目和依赖项的主解决方案。

What is the correct way of splitting out your solutions?

Check out this chapter from the TFS guide by the Patterns & Practices team:

Chapter 3 - Structuring Projects and Solutions in Source Control

Pay special attention to this note to the "Partitioned Solution" scenario (which I believe you're actually trying to implement):

Unlike previous versions of Visual Studio, Visual Studio 2005 relies upon MSBuild. It is now possible to create solution structures that do not include all referenced projects and still build without errors. As long as the master solution has been built first, generating the binary output from each project, MSBuild is able to follow project references outside the bounds of your solution and build successfully. This only works if you use project references, not file references. You can successfully build solutions created this way from the Visual Studio build command line and from the IDE, but not with Team Build by default. In order to build successfully with Team Build use the master solution that includes all of the projects and dependencies.

薔薇婲 2024-08-31 04:05:35

无论您如何组织构建,开发人员都应该了解引用的工作方式,并在对引用进行更改时注意,他们不应该检查这些更改除非他们打算进行更改到构建过程

关于组织构建的主题 - 正如 Dmytrol 所说,项目引用应该在解决方案之间工作(只要目标已经构建,但无论如何文件引用也是如此)。

我的建议是将您的项目分组为小型可行的解决方案,并在这些解决方案中使用项目参考。您的主解决方案文件/构建也可以使用项目引用,但是,如果您发现较小解决方案之间的项目引用太难维护,您可以使用文件引用来代替,并通过项目依赖项或项目构建顺序(可在 Visual 中访问)来控制构建顺序Studio,方法是右键单击解决方案中的项目)。

Regardless of how you organise your build, developers should understand how references work, and be aware when they make changes to references that they shouldn't check those changes in unless they intended to make a change to the build process.

On the subject of organising your builds - as Dmytrol says, project references should work between solutions (As long as the target is already built, however that's also the case for file references anyway).

My advice would be to group your projects into small workable solutions and use project references within those solutions. Your main solution file / build can use project references too, however if you find project references between the smaller solutions too difficult to maintain you can use file references instead, and control the build order through project dependencies or the project build order (accessible within Visual Studio by right-clicking on a project in your solution).

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