简体   繁体   中英

Dotfuscator and types from merged assemblies

With Dotfuscator Professional V4.8 (by PreEmptive Solutions), is it possible to make a public type from a merged (aka linked) non-primary assembly a public type of the merged assembly?

That is, suppose assembly A has a public type called Foo, and assembly B has some public method with a signature that includes type Foo. After merging A and B into C, with B as the primary assembly, I'd like Foo to be a public type of C.

It seems that dotfuscator always makes type Foo internal to C.

  • I've tried adding [System.Reflection.Obfuscation(Exclude=true)] to type Foo, but it appears to have no effect.
  • I don't care that the new type will be incompatible with the type from the original assembly.

Note: I work on the Dotfuscator team.

This should not be happening. I just made 2 small examples and could not reproduce the behavior you mention. My basic setups were

Tester.exe (Primary Assembly, both merged into out.exe)
  References Library
  public class Program { public void Method(Foo foo) {} }
Library.dll
  public class Foo {}

and

Tester.exe (Primary Assembly, all 3 merged into out.exe)
  References LibraryA & LibraryB
LibraryA.dll
  public class Foo {}
LibraryB.dll
  References LibraryA
  public class C { public void Method(int x, Foo foo) {} }

In both cases, Foo remains public.

The behavior you are describing is often what users want to happen, but we do not knowingly change any accessibility levels because of merging.

Please let me know if your setup was somehow different than mine. I'd be interested to see your exact repro. If you're able, please send it to support@preemptive.com and reference this thread. Thanks.

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