开发者

Does ILMerge actually merge assemblies, or just put everything in one file?

开发者 https://www.devze.com 2023-01-22 01:23 出处:网络
What does ILMerge do? Does it create a single new assembly, or just put multiple assemblies in to one dll?

What does ILMerge do?

Does it create a single new assembly, or just put multiple assemblies in to one dll?

I'm asking from the perspective of:

  • What happens when I'm merging assemblies that have InternalsVisibleTo attributes to eac开发者_开发百科h other?
  • What happens if I'm doing reflection from strings from fully qualified assembly names

Thanks


I'm not sure what distinction you're trying to draw between merging assemblies and putting everything into one file. What it does though is take a set of .Net assemblies and produces a single assembly which contains the combined contents of all of the assemblies.

This has no affect on the InternalsVisibleTo attribute for the assemblies being merged. This attribute is used by the runtime to allow access to internal constucts between assemblies (which is otherwise illegal). Since they are all now in one assembly though they are free to access each other's internal types without the use of InternalsVisibleTo. So in short, if the internal access was valid before the merge, it will be valid after the merge.

I'm unsure as to what you mean by the reflection and fully qualified assembly names. But there seem to be two cases I can think of

  1. Grabbing a types assemblie qualified name at runtime. This will still work fine but you will get the merged assembly name instead of the original assembly name
  2. Hard coding assembly qualified names of types into a project. This will cause issues if you use the assembly name before the merge as that type no longer exists.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号