Skip to content
Enables declaring 'InternalsVisibleTo' items in a .NET project file, rather than declaring them to an AssemblyInfo.cs file.
Branch: master
Clone or download
Pull request Compare This branch is 4 commits ahead, 5 commits behind thomaslevesque:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


The code is an adaptation of to fit my needs. It adds the notion of suffix and the default suffix.

NuGet version

Allow to declare InternalsVisibleTo in the csproj file, rather than declaring them to an AssemblyInfo.cs file.

How to use

  1. Install the Meziantou.MSBuild.InternalsVisibleTo NuGet package.
  2. Edit your csproj file:
<Project Sdk="Microsoft.NET.Sdk">
    <InternalsVisibleTo Include="CustomTest1" /> <!-- [assembly: InternalsVisibleTo("CustomTest1")] -->
    <InternalsVisibleTo Include="CustomTest2, PublicKey=abc" /> <!-- [assembly: InternalsVisibleTo("CustomTest2, PublicKey=abc")] -->
    <InternalsVisibleTo Include="$(AssemblyName).Custom" /> <!-- [assembly: InternalsVisibleTo("ClassLibrary1.Custom")] -->

    <InternalsVisibleToSuffix Include=".Tests" /> <!-- [assembly: InternalsVisibleTo("ClassLibrary1.Tests")] -->
    <InternalsVisibleToSuffix Include=".FunctionalTests" /> <!-- [assembly: InternalsVisibleTo("ClassLibrary1.FunctionalTests")] -->


This will generate the appropriate InternalsVisibleTo attributes for your assembly.

You can’t perform that action at this time.