.net - 来自多个项目的单个装配

标签 .net assemblies

在一个解决方案中涉及多个项目的 .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/

相关文章:

c# - NHibernate 的 T4 模板? - 不流利的 NHibernate

.net - .NET RSACryptoServiceProvider 中的 PyCrypto 签名消息和验证签名

c# - 无法转换类型为 'NHibernate.Collection.Generic.PersistentGenericBag' 的对象

.net - XML 注释——您如何(或在哪里)为您的命名空间和库创建 XML 注释?

c# - Assembly.CreateInstance 和 Activator.CreateInstance 之间的区别?

c# - 从 pfx 文件中提取公钥(类似程序集)

.net - 如何调试堆栈跟踪中没有您的代码的 WPF 异常?

c# - "object does not contain a definition for <field>"使用反射

assemblies - 将汇编和调试符号(pdb 文件)添加到 GAC - Wix 安装程序

visual-studio-2008 - VS2008中的自动汇编版本号管理