ILMerge DLL:程序集未正确合并,仍列为外部引用
在 .NET C# 工具的构建过程中,我一直在使用 ILMerge 将程序集合并到单个 exe 中。
我最近添加了一个新的类库,现在 ILMerge 失败了。我记得告诉它合并到新的 DLL 中!
它现在给了我这个错误,我不太明白:
ILMerge.Merge:程序集 “DataObjects”未合并到 正确。它仍然被列为 目标中的外部参考 组装。
我使用“项目”引用完成的所有程序集引用,过去都没有失败。
任何人都可以为我解释这个错误,或者建议一个解决方法吗?
In the build process for a .NET C# tool, I have been using ILMerge to merge the assemblies into a single exe.
I added a new class library recently, and now the ILMerge is failing. I have remembered to tell it to merge in the new DLL!
It is now giving me this error, which I don't really understand:
ILMerge.Merge: The assembly
'DataObjects' was not merged in
correctly. It is still listed as an
external reference in the target
assembly.
All of the assembly references I have done using 'project' references, and it has not failed in the past.
Can anyone explain this error for me, or suggest a workaround please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我必须使用
/close
参数。根据官方文档:I had to use the
/closed
argument. According to the official docs:当我尝试发布将所有输出合并到单个程序集的 Web 应用程序时,我收到了类似的错误消息:
如果您要合并的程序集名称与
Properties > 下的 Web 应用程序的程序集名称相匹配,就会发生这种情况。应用程序
。更改输出程序集名称应该可以修复它。I got a similar error message when trying to publish a web app that merged all outputs to a single assembly:
This happens if the assembly name you are merging to matches the assembly name of the web application under
Properties > Application
. Changing the output assembly name should fix it.我收到此错误,它指向我正在合并到单个 dll 中的 Microsoft.Xrm.Sdk 引用。当我设置另一个引用 Microsoft.Xrm.Sdk.Deployment 也合并到 dll 中时,问题得到解决。有趣的是,在一个单独的项目中,我进行了第一个参考合并,而第二个部署 dll 没有合并&它根本没有抱怨。
I got this error and it pointed to the Microsoft.Xrm.Sdk reference which I was merging into the single dll. The problem was fixed when I set another reference, Microsoft.Xrm.Sdk.Deployment to merge into the dll as well. Funny thing is in a separate project I had the 1st reference merging and the 2nd deployment dll not merging & it did not complain at all.
这正是@HughJeffner 作为图像的答案。我花了一段时间&有些人试图复制这些说明。
This is exactly @HughJeffner's answer as an image. It took me a while & some tries to replicate the instructions.
发布时从配置中选择“不合并”,然后发布项目
While publishing select 'Do not merge' from configure and than publish the Project
我收到了
System.Memory.dll
的错误,这很奇怪。在合并和部署 Dynamics CRM 插件 dll 的上下文中。我实际上只是忽略了它并部署了我的合并 DLL... 相信 Dynamics CRM 的插件上下文会在部署时提供它。
即使出现有关
System.Memory.dll
的错误,MergedPlugin.dll
仍然会构建。所以我只是将该插件部署到 CRM,并且它起作用了。I got this error for
System.Memory.dll
which was odd. In the context of merging and deploying a Dynamics CRM Plugin dll.I actually just ignored it and deployed my Merged DLL... trusting that Dynamics CRM's Plugin context would provide it when it's deployed.
The
MergedPlugin.dll
was still built even with the error aboutSystem.Memory.dll
. So I just deployed the Plugin to CRM, and it worked.