Jim L
Jim L

Reputation: 2327

Dealing with dependencies in a large project... Is it possible to reliably alter build order without using project dependencies in C#/VS2008?

I've got a legacy project in VS2008 that we're about to start refactoring for better componentization. The references between the 150 projects in the solution are messy, so as a starting point, I'm trying to at least get to a point I can have a few projects use binary references to other projects while others use project references. (For build time reasons)

To Illustrate, given projects A, B, and C, I'd like to see...

A references C.dll

B references C.csproj

Now the problem is I need to make sure that C.csproj builds before A.csproj. I know I can control build order using project dependencies, but this appears to cause exactly the behavior I'm trying to avoid... building A always causes C to build. I'm sure I can monkey with the proj or sln files directly to get things to build in the order I want, but I'm also sure that will get overwritten in short order by VS's automatic magic.

Is there some way to control this order reliably, or am I missing something obvious here?

Thanks...

Upvotes: 0

Views: 110

Answers (2)

dkackman
dkackman

Reputation: 15559

Separate related components (.csproj) into individual solutions. This enforces binary references across package boundaries. It also forces you and other developers to group components by layer.

Then use your build process to build solutions in correct order starting with the least dependent packages.

In my estimation, from an SCM standpoint Solution == UML Package == Merge Module (all solutions create a merge module)

Upvotes: 1

Steven Evers
Steven Evers

Reputation: 17196

You could make custom msbuild files instead of relying on the .csproj and .sln files, such that, depending on the target chosen, it will only build certain assemblies. It would require learning msbuild if you don't know it already though.

Upvotes: 1

Related Questions