2

I want to use the InternalsVisibleTo attribute solely to allow meaningful unit tests.

However, I am worried that when I will build for release the internal members will not get obfuscated, even though no friend assemblies will be part of the release build.

Is there anything I can/need to do that will cause these internal members to be considered truly internal for release builds? Cannot find a clear answer either way on this online.

FYI: I have not made a choice for a specific obfuscator yet. Any answers to this question may influence that choice.

Stefan de Kok
  • 2,018
  • 2
  • 15
  • 19

1 Answers1

6

Try using a pre-processer directive. You can either define your own symbol or use the built in RELEASE or DEBUG symbols

#if !RELEASE
[assembly: InternalsVisibleTo("X")]
#endif
cordialgerm
  • 8,403
  • 5
  • 31
  • 47