延迟签署的装配链(Delay signed assemblies chain)

编程入门 行业动态 更新时间:2024-10-13 10:24:18
延迟签署的装配链(Delay signed assemblies chain)

我正在开发一个C#.NET程序集(名称:A.exe),需要延迟签名,然后由第三方公司完全签名。 为了延迟签名,我使用公钥。 程序集A引用程序集B.Core.dll,B.Common.dll,B.Logging.dll,它们是公共库的一部分。 B组件没有延迟签名,因此我使用ildasm / ilasm来反汇编它们并重新组合延迟签名。 我提交了A.exe和B.Core.dll,B.Common.dll,B.Logging.dll,它们现在已完全签名,但是当A启动它时会报错: 无法加载文件或程序集'Assembly B1 PublicKeyToken = null' 该问题不应与A.exe相关,因为它引用了延迟签名的程序集(它们将Strong Name属性设置为True),但我怀疑罪魁祸首是B.Core。 实际上,B.Core引用了B.Common和B.Logging,而B.Common和B.Logging是相互独立的。 错误的原因可能是B.Core最初使用非签名的B.Common程序集构建,然后反汇编并重新组装所有三个程序集都没有更改引用...为了解决问题,我是什么我想要做的就是将所有四个组件合并为一个单一的延迟签名组件作为A的后置构建步骤。你认为它会起作用吗? 要记住的一件事是B.Core使用.NET MEF从A动态加载导出的接口。这个过程会出现任何问题吗? 在此先感谢您的帮助

I'm developing a C# .NET assembly (name: A.exe) which needs to be delay signed and then fully signed by a third party company. In order to delay sign I use the public key. Assembly A references assemblies B.Core.dll, B.Common.dll, B.Logging.dll which are part of a common library. B-assemblies aren't delay signed, so I use ildasm/ilasm to disassemble them and reassemble delay-signed. I submitted A.exe and B.Core.dll, B.Common.dll, B.Logging.dll and they are now fully signed, however when A starts it complain with error: Could not load file or assembly 'Assembly B1 PublicKeyToken=null' The problem shouldn't be related to A.exe since it references delay signed assemblies (they have Strong Name property set to True), but I suspect the culprit is B.Core. Indeed, B.Core references B.Common and B.Logging, while B.Common and B.Logging are independent each other. The cause of the error might be that B.Core was initially built using a non-signed B.Common assembly and then disassemble and reassemble all the three assemblies didn't change references... In order to solve the problem, what I was thinking to do is merging all the four assemblies into one single delay signed assembly as a post build step of A. Do you think it will work? One thing to keep in mind is that B.Core uses .NET MEF to dynamically load exported interfaces from A. Will this process present any issue? Thanks in advance for your help

最满意答案

我找到了一个解决方案:我设法使用ILMerge将四个程序集合并为一个,因此一切都按预期工作。 甚至调试符号也被“合并”到一个PDB文件中(诀窍是将B.Core.pdb,B.Common.pdb和B.Logging.pdb放在相应程序集的同一文件夹中)。

MEF毫无怨言地完成了工作。

I found a solution: I managed to use ILMerge to merge the four assemblies into one, therefore everything worked as expected. Even debug symbols were "merged" into a single PDB file (the trick was to have B.Core.pdb, B.Common.pdb and B.Logging.pdb in the same folder of the respective assemblies).

MEF did the work without complaining.

更多推荐

本文发布于:2023-07-06 07:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047426.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:signed   Delay   chain   assemblies

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!