InternalsVisibleTo.MSBuild
Enables declaring 'InternalsVisibleTo' items in a .NET project file, rather than declaring them to an AssemblyInfo.cs file.
Install / Use
/learn @thomaslevesque/InternalsVisibleTo.MSBuildREADME
InternalsVisibleTo.MSBuild
Enables declaring InternalsVisibleTo items in a .NET project file, rather than declaring them in an AssemblyInfo.cs file.
IMPORTANT: starting with .NET 5.0, the SDK already provides support for this. You don't need this package if you're using the .NET 5.0 SDK or later.
How to use
-
Install the
InternalsVisibleTo.MSBuildNuGet package. -
Edit your csproj file and add
<InternalsVisibleTo>items in your project for each assembly that should have access to the internals of the current project:<ItemGroup> <InternalsVisibleTo Include="$(AssemblyName).UnitTests" /> <InternalsVisibleTo Include="SomeOtherAssembly" /> <InternalsVisibleTo Include="StronglyNamedAssembly, PublicKey=0123....." /> </ItemGroup>This will generate the appropriate
InternalsVisibleToattributes 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 --> <InternalsVisibleToSuffix Include=".UnitTests" /> </ItemGroup>
Note
In fact, it's already possible to declare InternalsVisibleTo attributes in the project file without this package, but the syntax is ugly and hard to remember:
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>SomeOtherAssembly</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
This package just makes things easier by transforming <InternalsVisibleTo> elements into appropriate <AssemblyAttribute> elements.
Related Skills
node-connect
351.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
Security Score
Audited on May 1, 2024
