Search code examples
visual-studio-2010projects-and-solutionsclass-librarymultiple-projects

merging multiple projects into one project in solution


Is it possible to create solution in which I'll have some projects of Class Library type, and another one merging project, that will be Class Library containing source of all other projects in solution ?


Solution

  • It's possible to share code files between projects by adding them as a link in the additional projects. I use this technique to share copies of PetaPoco, common AssemblyInfo files, etc. between my projects. You could possibly use this technique to do what you want.

    To do this, add and create the code files you want to the first project as you normally would. Then, in the projects in which you want to use an existing code file:

    1. Right-click the project in Visual Studio Solution Explorer.
    2. Choose Add -> Existing item...
    3. Choose the code file that already exists, but on the Add button click the down arrow and choose "Add as Link" instead.

    Now anytime you make changes to the original file, it will be reflected in all the other projects in which you added that file as a link.

    Hope this helps.