#HowTo Make visible internal assembly components to another assembly in a C# project (InternalsVisibleTo).

In this post, I’m going to explain to you how to make the internal components of a DotNet assembly visible to another one.

First steps.

  • There are two different approaches to solve this. They’re the same, the only difference is where you will write the statement.
  • You must have access to the project file that contains the internal components.
  • You can’t make visible internals in an already compiled assembly.
  • Furthermore, you must know the assembly name of the project that will use the internals.

AssemblyInfo.cs approach.

If you have the file «YourProject/Properties/AssemblyInfo.cs» available in your project, then you can add the next statement.

Csproj approach.

In SDK project files, you should add this statement in your project file. The compiler will add the InternalVisibleTo attribute when your solution is being built.

 

Gustavo Sánchez

Soy especialista en escribir software de calidad. Mediante el uso de marcos de trabajo, técnicas y automatización de procesos he podido reducir los costes operativos de los sistemas de la empresa. Sistemas confiables y adaptables producen clientes felices.