I have a C# .NET Core web application solution consisting of 127 projects.
Some of them are smaller, built faster (less than 3s), some of them last longer (more than 45s).
Unfortunately, some of those long lasting are built at the end, without obvious reason.
For example, the project lasting 45s seconds is built as 111th out of 127 and this causes 30+s delay before the last project (this one has dependency on the slow one) can be build.
The slow one has direct/indirect dependencies only on 17 other project, so I would like to force the VS2022 to start building it as soon as those 17 are done.
I am running 16 parallel builds so it would be great to make some cores busy with the big projects and let the small ones build in parallel.
From the VS perspective, it does not matter if it is built as 18th or 111th, but starting with that project too late means directly prolong total built time. The same applies to other bigger projects from this solution.
Sum of build times of all those 127 projects divided by degree of parallelism shows that without those delays due to larger projects built too lately total built time of the solution could be 40% shorter.
So is there any flag, setting trick that would let me force VS to prepare build sequence in a way that these priority projects (and their dependencies) are built sooner and remaining projects in a “random” order honoring dependencies?
I tried to add artificial build dependency to other projects on this project to postpone their build and make VS choose the slow one sooner.
If the dependency was too restrictive, this slow project was built as 70th but other projects were waiting for this one so delay was still there and CPU was not fully utilized.
If the dependency was not so restrictive, VS build smaller projects too early and the delay was there.
Even manual editing of the solution file and reordering the project (without modifying any dependencies) has an impact on the ordering and the mentioned project builds after some modification as 90th, after other modification as 103rd. But I could not find any clue how my edits of sln file impact build order.
hrontos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.