[英]How does CLR load a file from an assembly?
Below is a multifile assembly consisting of two managed modules, one with a manifest:下面是一个多文件程序集,由两个托管模块组成,一个带有清单:
so RUT.netmodule(RUT stands for rare used types) is a file(.netmodule) that's part of the assembly.所以 RUT.netmodule(RUT 代表罕见的使用类型)是一个文件(.netmodule),它是程序集的一部分。
Let's say my client application references a type from RUT.netmodule
and MultiFileLibrary.dll
is a strong name assembly and it is installed in GAC.假设我的客户端应用程序引用了RUT.netmodule
中的一个类型, MultiFileLibrary.dll
是一个强名称程序集,它安装在 GAC 中。 Because RUT.netmodule
doesn't physically reside in MultiFileLibrary.dll
, so GAC won't have RUT.netmodule
.因为RUT.netmodule
在物理上并不驻留在MultiFileLibrary.dll
中,所以 GAC 不会有RUT.netmodule
。
so my question is, maybe CLR is configured to check application's base directory to look for RUT.netmodule
after it knows that the referenced type is in a different module file.所以我的问题是,也许 CLR 被配置为检查应用程序的基目录以在知道引用的类型在不同的模块文件中之后查找RUT.netmodule
。 But it also means that RUT.netmodule
have to always in application's base directory, which sounds strange to me as if I have mutiple applications then I need to have multiple RUT.netmodule
in their base directory.但这也意味着RUT.netmodule
必须始终位于应用程序的基本目录中,这对我来说听起来很奇怪,好像我有多个应用程序然后我需要在它们的基本目录中拥有多个RUT.netmodule
。 Is a way to "install" RUT.netmodule
in GAC or when MultiFileLibrary.dll
is installed in GAC, any .netmodule files are also copied into GAC?是否有一种在 GAC 中“安装” RUT.netmodule
的方法,或者当在 GAC 中安装MultiFileLibrary.dll
时,任何 .netmodule 文件也会被复制到 GAC 中?
I have never working with multi-file assemblies but as far as I can tell you should be able to sign the .netmodule by using the assembly linker tool (al.exe).我从未使用过多文件程序集,但据我所知,您应该能够使用程序集 linker 工具 (al.exe) 对 .netmodule 进行签名。 The documentation contains a small quote which might be relevant:该文档包含一个可能相关的小引号:
How to: Sign an assembly with a strong name如何:使用强名称签署程序集
... ...
- By using the Assembly Linker (Al.exe) to link a .NET Framework code module (a .netmodule file) with a key file.通过使用程序集 Linker (Al.exe) 将 .NET 框架代码模块(.netmodule 文件)与密钥文件链接。
My guess is that even when you place the assembly in GAC it will still reference the .netmodule and it should work if the .netmodule is signed.我的猜测是,即使您将程序集放在 GAC 中,它仍然会引用 .netmodule 并且如果 .netmodule 已签名,它应该可以工作。 Hope this information helps you.希望这些信息对您有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.