在一个解决方案中涉及多个项目的 .net 应用程序中,我有一个命名空间设置为 Company.Product.UI 的项目和另一个设置为 Company.Product.UI.WebPages 的项目。我的问题是构建这两个项目会产生两个 dll。我怎样才能拥有一个 dll 并仍然保留当前的解决方案结构。我使用 Visual Studio 2008 和 C#。
最佳答案
您必须将两个项目合并为一个项目或使用类似 ILMerge 的工具。将生成的程序集合并为一个程序集。
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.
如果您想将 ILMerge 作为 MSBuild 任务自动化,那么我建议您查看 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.
关于.net - 来自多个项目的单个装配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/893267/