Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enables declaring 'InternalsVisibleTo' items in a .NET project file, rather than declaring them to an AssemblyInfo.cs file.

License

NotificationsYou must be signed in to change notification settings

thomaslevesque/InternalsVisibleTo.MSBuild

Repository files navigation

NuGet version

Enables declaringInternalsVisibleTo items in a .NET project file, rather than declaring them in an AssemblyInfo.cs file.

IMPORTANT: starting with .NET 5.0, the SDKalready provides support for this. You don't need this package if you're using the .NET 5.0 SDK or later.

How to use

  1. Install theInternalsVisibleTo.MSBuild NuGet package.

  2. Edit your csproj file and add<InternalsVisibleTo> items in your project for each assembly that should have accessto the internals of the current project:

      <ItemGroup>    <InternalsVisibleToInclude="$(AssemblyName).UnitTests" />    <InternalsVisibleToInclude="SomeOtherAssembly" />    <InternalsVisibleToInclude="StronglyNamedAssembly, PublicKey=0123....." />  </ItemGroup>

    This will generate the appropriateInternalsVisibleTo attributes for your assembly.

    Alternatively, you can also use<InternalsVisibleToSuffix> to specify that assemblies named$(AssemblyName).<suffix> will have access to the internals of the current project:

      <ItemGroup><!-- $(AssemblyName).UnitTests will have access to the internals of this project-->    <InternalsVisibleToSuffixInclude=".UnitTests" />  </ItemGroup>

Note

In fact, it's already possible to declareInternalsVisibleTo attributes in the project file without this package, but the syntax is ugly and hard to remember:

  <ItemGroup>    <AssemblyAttributeInclude="System.Runtime.CompilerServices.InternalsVisibleTo">      <_Parameter1>SomeOtherAssembly</_Parameter1>    </AssemblyAttribute>  </ItemGroup>

This package just makes things easier by transforming<InternalsVisibleTo> elements into appropriate<AssemblyAttribute> elements.

About

Enables declaring 'InternalsVisibleTo' items in a .NET project file, rather than declaring them to an AssemblyInfo.cs file.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors5


[8]ページ先頭

©2009-2025 Movatter.jp