views:

2254

answers:

7

I have 3 solutions and solution A requires built versions of the dlls from solution B and C in order to compile. it is not possible to merge it to one solution...

So far it seems that Visual Studio doesnt support solution references and msbuild is clever enough to know that you are building one solution from another etc if I try that way. The overall goal is to try to make the multiple solutions seem almost like there is only one - just solution A.

I believe this is a common problem, but how do you link it up nicely?

+1  A: 

It should be project level you are looking at I believe. Build the projects contained within Solution B and C and then add references to the DLLs in the relevant projects in Solution A.

In Msbuild if you have a property group

<PropertyGroup>

<SolutionsToBuild>SolutionB</SolutionsToBuild>
<SolutionsToBuild>SolutionC</SolutionsToBuild>
<SolutionsToBuild>SolutionA</SolutionsToBuild>
</PropertyGroup>

Then execute the MSBuild Task

<MSBuild Projects="@(SolutionsToBuild)"/>

Hope this helps

Dean
A: 

You could try to add command line build commands for the dll (in solution B and C) you depend on in the prebuild events of your projects (in solution A)

Brann
A: 

If you can't put projects B and C into the same solution as project A then there's no way to make sure you have binaries for B and C containing the latest source code when you build project A.

The easiest solution I've seen is to have a common folder in the source code repository where every project copies its binaries if they need to be shared. Then all other projects can reference binaries in that folder as long as your local folders look the same as the repository.

Not a perfect solution, but it's pretty easy to work with.

awhite
A: 

You can add a Makefile project to solution A which would build your solutions B and C (using msbuild for example) and make all the projects in A dependent on that Makefile project. This way you wouldn't be able to add project references to projects in B and C, but you can use dll references and they will always be built from latest sources.

Juozas Kontvainis
+2  A: 

I have recently discovered that in Visual Studio 2008 you can include existing projects in multiple solutions. The only downside so far seems to be that if you make a change to a shared project and have multiple solutions open that use that shared project you will be asked to "reload" the other solutions.

So, just "Add Existing Project" to all the solutions that need the project. I am using TFS on my current site and there seems to be no issues with source control ether.

Paul
+2  A: 

This question has popped up in different, but related, forms. There is actually an MSDN page that covers this.

What you're looking for is a multi-solution approach akin to the Partitioned Single Solution Model for Larger Systems. Have one "everything" solution that builds everything and maintains your inter-component dependencies. This is what you build when you need to build solution A. You then have separate solutions that only include components B or C. Essentially, you'll still have 3 solutions, but you'll add the projects from solutions B and C into solution A.

Greg D
A: 

Greg, this page is about 7 years old. I was hoping there would be a more sophisticated solution for this problem by now. Working with a single solution in large projects is a pain.

Michael Sander