7

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

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

由于解决方案太大,我们有几个日常使用的较小解决方案:

SubSolution
- Project 1
- Project 19

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

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

4

2 回答 2

2

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.

于 2010-06-18T11:20:38.470 回答
2

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

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

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

于 2010-06-18T11:44:30.673 回答