Generate Project Dependancies for Building Order

Viewed 24

I have multiple C++/C# Visual Studio Solutions some depend on each other, in the building Process I make the building order manually and build them one by one until the end.

now I will be going to continuous Integration "CI", My Question Is: is there any tool or method to automatically generate the correct building order?

My Project Structure Looks Like that:

All_Code:

  • VS Solution A:

    • Project A.1
    • Project A.2
  • VS Solution B:

    • Project B.1
    • Project B.2

Let's say Project B.1 Depends on A.1 and A.2 Depends on B.2 so, when I am building I order them as follows:

  • A.1
  • B.1
  • B.2
  • A.2
1 Answers

Create one solution (.sln) file that contains all the projects in the CI build and plan to use that solution file for the CI build.

Now, you can either discard the use of the existing 'A.sln' and 'B.sln' solutions and add project references in the projects (Project B.1 would have a project reference to A.1 for example) or set the build order in the new .sln file itself.

Prefer to use project references if possible because they have options and capabilities that the other approach doesn't offer. But note that a project reference is a change to the project file. Further the referencing project and the referenced project must both be in the solution. That means that using project references will break the existing 'A.sln' and 'B.sln' solutions.

You can, however, create solution filter files (.slnf) for the new .sln to create 'views' that are equivalent to the 'A.sln' and 'B.sln'. (See Filtered solutions in Visual Studio.)

If you need to keep 'A.sln' and 'B.sln' and keep them useable, you can manually set the build order in the new solution. In the solution properties in the 'Project Dependencies' section, manually set each project's dependencies. This is stored in the .sln file. The project files are not changed. However, the dependencies set in the .sln file will need to be kept in sync with the project's actual dependencies.

The tooling will automatically determine the build order based on both the project references in the projects and the project dependencies in the solution.

Related