MakeTypesPublic 1.0.3

dotnet add package MakeTypesPublic --version 1.0.3                
NuGet\Install-Package MakeTypesPublic -Version 1.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MakeTypesPublic" Version="1.0.3">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MakeTypesPublic --version 1.0.3                
#r "nuget: MakeTypesPublic, 1.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MakeTypesPublic as a Cake Addin
#addin nuget:?package=MakeTypesPublic&version=1.0.3

// Install MakeTypesPublic as a Cake Tool
#tool nuget:?package=MakeTypesPublic&version=1.0.3                

Overview

The package MakeTypesPublic is intended to disable access checks to non-public (private, internal) types and its members in other assemblies.

How to use it

  • You should set the <IgnoreAccessChecks>true</IgnoreAccessChecks> property. By default it's enabled only for compile-time builds (not for design-time builds). So, Visual Studio will show errors but compiler and runtime will work.
  • You should set up the ProjectReference and PackageReference items with the IgnoreAccessChecks="true" attribute.

Examples

<PropertyGroup>
    <IgnoreAccessChecks>true</IgnoreAccessChecks>
</PropertyGroup>

<ItemGroup>
    <ProjectReference Include="..\Lib\Lib.csproj" IgnoreAccessChecks="true" />
    <PackageReference Include="NuGetPackage" IgnoreAccessChecks="true" />
</ItemGroup>

How it works

There are a few types of access checks:

  • Compile-time access checks. You should compile with fake assemblies with public types and members (ideally reference-only assembly) to disable it. The Roslyn has options to disable access checks but those options are internal. To learn more see the following links: Link 1, Link 2, Link 3.
  • Run-time access checks. You should add IgnoresAccessChecksToAttribute assembly attributes to disable it.
  • Design-time access checks. There is a problem here. You could make Visual Studio to consume the fake assemblies. But this can lead to some problems. So I preferred just ignore those errors. Maybe there are other ways to suppress these errors? But I don't know them. If you still want to make Visual Studio to consume the fake assemblies you can set IgnoreAccessChecks property to true. By default this property is true only for not design-time builds.

Github

https://github.com/Denis535/MakeTypesPublic

NuGet

https://www.nuget.org/packages/MakeTypesPublic

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 625 8/31/2021
1.0.2 408 8/31/2021
1.0.1 436 11/27/2020
1.0.0 494 11/27/2020