- Notifications
You must be signed in to change notification settings - Fork6
Enables declaring 'InternalsVisibleTo' items in a .NET project file, rather than declaring them to an AssemblyInfo.cs file.
License
thomaslevesque/InternalsVisibleTo.MSBuild
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
Install the
InternalsVisibleTo.MSBuild
NuGet package.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 appropriate
InternalsVisibleTo
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>
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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.