Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Single assembly from multiple projects

In a .net application involving several projects in one solution, I have a project with the namespace set to Company.Product.UI and another one with Company.Product.UI.WebPages. My problem is that two dlls result from building the two projects. How can I have a single dll and still preserve the current solution structure. I use Visual Studio 2008 and C#.

like image 949
kjv Avatar asked May 21 '09 14:05

kjv


People also ask

Can you use the same functions in multiple projects?

It all depends on dependency-level of function add . If it is self contained function (like sorting), you can striaghtaway use in another project as suggest by Chad in point 2. If function has dependency (forms, classes other stuff), you may be in trouble. You may need to share all that into another project too.

Can Visual Studio run two projects at once?

Visual Studio allows you to specify how more than one project is run when you press F5 (Start with Debugging), or Ctrl+F5 (Start without debugging), or use the toolbar button to launch your application.


1 Answers

You will have to either merge the two projects into one project or use a tool like ILMerge to merge the resulting assemblies into a single assembly.

ILMerge is a utility that can be used to merge multiple .NET assemblies into a single assembly. It is freely available for use from the Tools & Utilities page at the Microsoft .NET Framework Developer Center.

If you want to automate ILMerge as an MSBuild task then I would suggest you take a look at ilmerge-tasks:

Interested in using ILMerge during an automated build? ILMerge Tasks containts two buildable projects that will allow you to access ILMerge as a task from both MSBuild and NAnt. It even includes a post-build event that merges ILMerge and the task dll so that you can use the task without ILMerge.exe being present.

like image 137
Andrew Hare Avatar answered Sep 23 '22 02:09

Andrew Hare