<p>Using VS2005 and VB.NET.</p>

<p>I have a project that is an API for a data-store that I created. When compiled creates <code>api.dll</code>.</p>

<p>I have a second project in the same solution that has a project reference to the API project which when compiled will create <code>wrapper.dll</code>. This is basically a wrapper for the API that is specific to an application.
When I use <code>wrapper.dll</code> in that other application, I have to copy <code>wrapper.dll</code> and <code>api.dll</code> to my new application. How can I get the wrapper project to compile the <code>api.dll</code> into itself so that I only have one <code>dll</code> to move around?</p>

[{'answer_id': 30836, 'author': 'Blair Conrad', 'author_id': 1199, 'author_profile': 'https://Stackoverflow.com/users/1199', 'pm_score': 1, 'selected': False, 'text': '<p>You\'ll probably have to use a tool, such as <a href="http://research.microsoft.com/~mbarnett/ILMerge.aspx" rel="nofollow noreferrer">ILMerge</a>, to merge the two assemblies.</p>\n'}, {'answer_id': 30843, 'author': 'TheSmurf', 'author_id': 1975282, 'author_profile': 'https://Stackoverflow.com/users/1975282', 'pm_score': 1, 'selected': False, 'text': "<p>There's an easier way. Just create shortcuts (called linked files in Visual Studio-ese) in your wrapper.dll project that point to the source files in api.dll. That will compile your source directly into wrapper.dll.</p>\n"}, {'answer_id': 30869, 'author': 'Pete', 'author_id': 3059, 'author_profile': 'https://Stackoverflow.com/users/3059', 'pm_score': 0, 'selected': False, 'text': '<p>I think you could compile api.dll as a resource into wrapper.dll.  Then manually access that Resource out of api.dll and manually load it.  I have manually loaded assemblies from disk, so loading one from a Stream should not be any different.</p>\n\n<p>I would try including the dll in your project as a file, similar to including a text or xml file (in addition to its project reference for compilation).  Then I would set the build action to "Embedded Resource."  Within wrapper.dll, I would use the Assembly object to access api.dll just like any other embedded resource.  You will then also want to load the assembly using Assembly.Load  <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.load.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.reflection.assembly.load.aspx</a></p>\n'}, {'answer_id': 32011, 'author': 'Blair Conrad', 'author_id': 1199, 'author_profile': 'https://Stackoverflow.com/users/1199', 'pm_score': 2, 'selected': True, 'text': '<p>@Jas, it\'s a special feature in Visual Studio. The procedure is outlined in <a href="http://blogs.msdn.com/shawnfa/archive/2006/04/24/582278.aspx" rel="nofollow noreferrer">this blog entry, called "Sharing a Strong Name Key File Across Projects"</a>.  The example is for sharing strong name key files, but will work for any kind of file.</p>\n\n<p>Briefly, you right-click on your project and select "Add Existing Item". Browse to the directory of the file(s) you want to link and highlight the file or files. Insted of just hitting "Add" or "Open" (depending on your version of Visual Studio), click on the little down arrow on the right-hand side of that button. You\'ll see options to "Open" or "Link File" if you\'re using Visual Studio 2003, or "Add" or "Add as Link" with 2005 (I\'m not sure about 2008). In any case, choose the one that involves the word "Link". Then your project will essentially reference the file - it will be accessible both from the original project its was in and the project you "linked" it to. </p>\n\n<p>This is a convenient way to create an assembly that contains all the functionality of wrapper.dll and api.dll, but you\'ll have to remember to repeat this procedure every time you add a new file to api.dll (but not wrapper.dll).</p>\n'}]
['https://Stackoverflow.com/questions/30833', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/777/']