Question

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.

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top