Search code examples
c#visual-studio-2010mercurialtortoisehgbitbucket

Including external projects as dlls


I have a VS2010 solution which uses its own projects (that are in that solution's folder, because I consider them directly related to this solution) but also reuses code from a few other solutions and projects - when working on this solution, I realized that I already had written code for doing certain tasks as parts of other, unrelated programs.

I have the main solution folder maintained as a Mercurial repository with TortoiseHg, however, it does not include my other external projects. When the local repository is pushed to my BitBucket repository, the code for my main solution is there, but the code from external projects is naturally missing.

How do I solve this problem?

  • Leaving it as is is convenient for me (although perhaps I'll need to be careful when moving around my code on the hard drive, and when modifying the external projects I use) but anyone who tries to build my BitBucket repository will not be able to do so, because some crucial code is basically missing (their VS will also complain because the sln file points to projects they don't have).
  • Including all of the projects would address the problem, but require me to redo the directory structure of my repository, and include a lot of irrelevant code to a person interested only in the one solution. Also, if I modify the external projects in a series of commits, to their own repositories, I will also have to commit all of those changes in one big blob to this solution's repository.
  • Pre-building the external projects into dlls, attaching those dlls to my solution and repository, and forgetting about the source code of the external project would be ideal. However, I don't know how to do this, and also will it be harder to use the dlls because the source code is not there? Will Intellisense break? Will I still see my documentation when using dlls?

Sorry for the basic question, but I am quite confused about what the "correct" way of doing this is.


Solution

  • The last option seems the most straightforward to me. Compile your external solutions/projects to .dlls using the build menu for each (make sure to build in release mode).

    Then add a reference in your main version-controlled project to the dll files. This won't break intellisense and your dll files will be distributed with your source code.