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#.
Each project results in a separate assembly. Do you have two projects or just two folders?
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.
I guess that you could create a new project file which contains all files from the two projects. That way you can keep the current structure for development, and use the merged project file to build the output to be released from the project. The project files are fairly straightforward xml files, so if you open one of then in a text editor you will probably figure out how they work rather quickly.
The obvious downside with this approach is of course that you will need to maintain this third project file when files are added or removed in one of the projects, but if that is something that does not happen very often it could work rather well, I think.