IgnoresAccessChecksToGenerator 1.0.0
dotnet add package IgnoresAccessChecksToGenerator --version 1.0.0
NuGet\Install-Package IgnoresAccessChecksToGenerator -Version 1.0.0
<PackageReference Include="IgnoresAccessChecksToGenerator" Version="1.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="IgnoresAccessChecksToGenerator" Version="1.0.0" />
<PackageReference Include="IgnoresAccessChecksToGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add IgnoresAccessChecksToGenerator --version 1.0.0
#r "nuget: IgnoresAccessChecksToGenerator, 1.0.0"
#:package IgnoresAccessChecksToGenerator@1.0.0
#addin nuget:?package=IgnoresAccessChecksToGenerator&version=1.0.0
#tool nuget:?package=IgnoresAccessChecksToGenerator&version=1.0.0
IgnoresAccessChecksTo Generator (MSBuild)
The IgnoresAccessChecksToAttribute is the reverse of the InternalsVisibleToAttribute - it allows an assembly to declare assemblies whose internals would be visible to it. The attribute class isn't declared in the BCL but is recognized by the CLR (Desktop >= 4.6 and Core), i.e. you can declare it in your code and it would work.
Since there's currently no compiler support for this attribute (I've submitted a PR to Roslyn), this package can be used as a workaround. It generates reference assemblies where all the internal types & members become public, and adds a C# file with the attribute and its instances.
Usage
Just add the package and define IgnoresAccessChecksTo items with the assemblies you need access to.
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<IgnoresAccessChecksTo Include="AssemblyToGrantAccessTo1" />
<IgnoresAccessChecksTo Include="AssemblyToGrantAccessTo2" />
<IgnoresAccessChecksToExcludeTypeName Include="Namespace.TypeName" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="IgnoresAccessChecksToGenerator" Version="0.8.0" PrivateAssets="All" />
</ItemGroup>
</Project>
Excluding types
Use IgnoresAccessChecksToExcludeTypeName to keep specific types from being publicized. By default an exclusion applies to every assembly being processed. To scope an exclusion to a single assembly, add the Assembly metadata:
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<IgnoresAccessChecksTo Include="AssemblyToGrantAccessTo1" />
<IgnoresAccessChecksTo Include="AssemblyToGrantAccessTo2" />
<IgnoresAccessChecksToExcludeTypeName Include="Namespace.TypeName" />
<IgnoresAccessChecksToExcludeTypeName Include="Namespace.OtherTypeName" Assembly="AssemblyToGrantAccessTo1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="IgnoresAccessChecksToGenerator" Version="0.8.0" PrivateAssets="All" />
</ItemGroup>
</Project>
Omitting the attribute definition
When set to true, the generator will not emit the IgnoresAccessChecksToAttribute class definition in the generated file. This is useful when you already have the attribute defined elsewhere in your project (for example, when multiple packages use the same attribute).
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IgnoresAccessChecksToOmitAttributeDefinition>true</IgnoresAccessChecksToOmitAttributeDefinition>
</PropertyGroup>
<ItemGroup>
<IgnoresAccessChecksTo Include="AssemblyToGrantAccessTo" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="IgnoresAccessChecksToGenerator" Version="0.8.0" PrivateAssets="All" />
</ItemGroup>
</Project>
Using with project references
If you want to ignore access checks to an assembly coming from a ProjectReference instead of a PackageReference, you'll need to set the CompileUsingReferenceAssemblies property to false.
<PropertyGroup>
<CompileUsingReferenceAssemblies>false</CompileUsingReferenceAssemblies>
</PropertyGroup>
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on IgnoresAccessChecksToGenerator:
| Package | Downloads |
|---|---|
|
AutoMockFixture.Moq4
Extensions for AutoFixture and Moq |
|
|
AutoMockFixture.AnalyzerAndCodeCompletion
Extensions for AutoFixture and Moq |
GitHub repositories (15)
Showing the top 15 popular GitHub repositories that depend on IgnoresAccessChecksToGenerator:
| Repository | Stars |
|---|---|
|
Sylinko/Everywhere
On-screen aware AI assistant for your desktop. Uses current app context, multiple LLMs, and MCP tools to help you act across apps.
|
|
|
kurrent-io/KurrentDB
KurrentDB is a database that's engineered for modern software applications and event-driven architectures. Its event-native design simplifies data modeling and preserves data integrity while the integrated streaming engine solves distributed messaging challenges and ensures data consistency.
|
|
|
CosmosOS/Cosmos
Cosmos is an operating system "construction kit". Build your own OS using managed languages such as C#, VB.NET, and more!
|
|
|
roslynpad/roslynpad
A cross-platform C# editor based on Roslyn
|
|
|
VitalElement/AvalonStudio
Cross platform IDE and Shell
|
|
|
FancyWM/fancywm
FancyWM - Dynamic Tiling Window Manager for Windows
|
|
|
NeoAxis/NeoAxisEngine
A versatile game engine designed for creating video games and real-time apps.
|
|
|
ashmind/mirrorsharp
MirrorSharp is a code editor <textarea> built on Roslyn and CodeMirror
|
|
|
aelij/IgnoresAccessChecksToGenerator
Generates reference assemblies where all the internal types & members become public, and applies the IgnoresAccessChecksTo attribute
|
|
|
npolyak/NP.Ava.UniDock
New (Avalonia 11) UniDock repository
|
|
|
chrisnas/ClrEvents
Source code based on TraceEvent to listen to CLR events at runtime
|
|
|
DearVa/LiveMarkdown.Avalonia
High performance, real-time markdown renderer for AI/LLM
|
|
|
jxnkwlp/abp-elsa-module
Elsa abp module and workflow app
|
|
|
YoshihiroIto/JitPad
On the fly disassemble C# code based on JitDasm
|
|
|
AvaloniaUI/Avalonia.Controls.Maui
Avalonia-based Handlers for .NET MAUI
|