PartialSourceGen.Attributes 0.0.2

dotnet add package PartialSourceGen.Attributes --version 0.0.2
NuGet\Install-Package PartialSourceGen.Attributes -Version 0.0.2
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="PartialSourceGen.Attributes" Version="0.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PartialSourceGen.Attributes --version 0.0.2
#r "nuget: PartialSourceGen.Attributes, 0.0.2"
#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 PartialSourceGen.Attributes as a Cake Addin
#addin nuget:?package=PartialSourceGen.Attributes&version=0.0.2

// Install PartialSourceGen.Attributes as a Cake Tool
#tool nuget:?package=PartialSourceGen.Attributes&version=0.0.2

NuGet Version

What is this

This is a library containing the marker attributes used in PartialSourceGen library. In the normal use case, this library is not necessary, so this should not be needed to install!

It is needed, if you need to enable InternalsVisibleTo and you will get an error of CS0436.

Why

The source generator generates the attributes used as markers into your project with an internal scope.

When enabling InternalsVisibleTo all projects that reference each other will generate their own version of the same attribute markers, which normally is not visible to other projects.

Installation

Run dotnet add package PartialSourceGen.Attributes to add the marker attributes.

Then in your csproj file enable PARTIALSOURCEGEN_EXCLUDE_ATTRIBUTES constant:

 
 <Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        
        <DefineConstants>PARTIALSOURCEGEN_EXCLUDE_ATTRIBUTES</DefineConstants>
    </PropertyGroup>
 </Project>

Contains

No logic only attributes.
The marker attributes can be found in the PartialSourceGen namespace:

  • Partial
  • IncludeInitializer
  • ExcludePartial
  • ForceNull
  • PartialReference

The PartialReference comes in 2 variants, the newer dotnet 7.0, generic attribute variant and the traditional non-generic attribute variant.

Alternative solution

You can write your own attributes and put them in the PartialSourceGen namespace. The attributes do not contain logic, and are only markers for the source generator.

Versioning

The versioning of this library does not follow the source generator versioning.

References

The main PartialSourceGen project can be found here: https://github.com/Newex/PartialSourceGen

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8.1

    • No dependencies.
  • net8.0

    • No dependencies.

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
0.0.2 83 4/6/2024
0.0.1 71 4/5/2024