GitHub - Tyrrrz/Binternal: Make any .NET dependency internal (original) (raw)

Status Made in Ukraine Build Version Downloads Discord Fuck Russia

Icon

Binternal is an MSBuild extension that lets you internalize package and project references by merging them into the output assembly as internal APIs. This effectively allows you to treat any dependency as a private implementation detail, which can be useful to reduce the exposed surface area of your package or when targeting execution scenarios where proper dependency resolution is not available.

Terms of use[?]

By using this project or its source code, for any purpose and in any shape or form, you grant your implicit agreement to all the following statements:

To learn more about the war and how you can help, click here. Glory to Ukraine! πŸ‡ΊπŸ‡¦

Install

Usage

In order to internalize a dependency, mark its corresponding PackageReference or ProjectReference with the Internalize attribute set to true:

Note

Consider also adding the PrivateAssets="all" attribute to references that are being internalized. This will make sure they are not passed as transitive dependencies to downstream consumers, which is important if you're building a NuGet package.

When the above project is built, CliWrap.dll, along with all of its own dependencies, will be merged into the output assembly. Public members exposed by this package will be converted into internal members, preventing them from being accessed by outside callers.