简体   繁体   中英

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.

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. Because RUT.netmodule doesn't physically reside in MultiFileLibrary.dll , so GAC won't have 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. 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. 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?

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). 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.

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. Hope this information helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM