How to link multiple visual studio solutions together?

前端 未结 9 1360
南笙
南笙 2021-02-01 01:28

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

相关标签:
9条回答
  • 2021-02-01 01:47

    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

    0 讨论(0)
  • 2021-02-01 01:52

    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.

    0 讨论(0)
  • 2021-02-01 01:55

    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.

    0 讨论(0)
  • 2021-02-01 02:02

    According to this answer, I would recommend you to create your own batch file which will build the relevant solutions for you.

    That's very handy to use because the build process will output the build progression (Similar to Output window in Visual Studio) to the command promote for each and every build executes.

    Furthermore, in a case that you need to build one solution before the other, you can write your own build order, for example:

    1. build solution B
    2. build solution C
    3. build solution A (which internally uses "solution B" and "solution C" built files)

    I've quickly written script to clarify the build order mentioned above and support most of modern Visual Studio versions.

    Regards.

    0 讨论(0)
  • 2021-02-01 02:03

    You can try to automate the merge process to save some time: http://code.google.com/p/merge-solutions/

    Although we had slightly different problem: about 15 solutions (~150 projects in total) that were using one common library. The problem was that if we tried to merge all of them into one in order to refactor / exterminate redundant code from common library. 1. merging 15 solutions involves a lot of clicking and waiting in VS 2. resulted solution was never up to date - nobody bothered updating it because of its size

    0 讨论(0)
  • 2021-02-01 02:06

    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.

    0 讨论(0)
提交回复
热议问题