BulletsForHumanity.Scribe.Sdk
0.6.4
dotnet add package BulletsForHumanity.Scribe.Sdk --version 0.6.4
NuGet\Install-Package BulletsForHumanity.Scribe.Sdk -Version 0.6.4
<PackageReference Include="BulletsForHumanity.Scribe.Sdk" Version="0.6.4" />
<PackageVersion Include="BulletsForHumanity.Scribe.Sdk" Version="0.6.4" />
<PackageReference Include="BulletsForHumanity.Scribe.Sdk" />
paket add BulletsForHumanity.Scribe.Sdk --version 0.6.4
#r "nuget: BulletsForHumanity.Scribe.Sdk, 0.6.4"
#:package BulletsForHumanity.Scribe.Sdk@0.6.4
#addin nuget:?package=BulletsForHumanity.Scribe.Sdk&version=0.6.4
#tool nuget:?package=BulletsForHumanity.Scribe.Sdk&version=0.6.4
BulletsForHumanity.Scribe.Sdk
A custom MSBuild SDK that eliminates boilerplate from Roslyn analyzer and source generator projects.
Quick Start
1. Add a global.json with the SDK version:
{
"msbuild-sdks": {
"BulletsForHumanity.Scribe.Sdk": "0.3.0"
}
}
2. Use the SDK in your .csproj:
<Project Sdk="BulletsForHumanity.Scribe.Sdk">
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" />
<PackageReference Include="BulletsForHumanity.Scribe" PrivateAssets="all" />
</ItemGroup>
</Project>
That's it. The SDK handles everything else:
TargetFramework=netstandard2.0(required by Roslyn compiler host)LangVersion=14for modern C# featuresEnforceExtendedAnalyzerRules=trueto catch common mistakes- Analyzer packaging (
analyzers/dotnet/cs/placement, embedded PDB) - Private dependency bundling (Scribe DLL alongside your analyzer)
Stubs.cspolyfills forinit,record,required, nullable annotations- LocalDev multi-repo development infrastructure
What the SDK Sets
| Property | Default | Purpose |
|---|---|---|
TargetFramework |
netstandard2.0 |
Required by the Roslyn compiler host |
LangVersion |
14 |
Modern C# features with polyfill stubs |
EnforceExtendedAnalyzerRules |
true |
Catches analyzer authoring mistakes |
IncludeBuildOutput |
false |
DLL goes into analyzers/, not lib/ |
PackageType |
Analyzer |
Marks package as an analyzer |
IncludeSymbols |
false |
PDB is embedded in the DLL |
DebugType |
embedded |
IDE debugging support |
Nullable |
enable |
Null-safety |
GenerateDocumentationFile |
false |
Not needed for bundled DLLs |
CopyLocalLockFileAssemblies |
true |
Enables private dependency bundling |
All defaults are set in the early phase (Sdk.props) and can be overridden in your .csproj. Packaging targets (analyzer DLL placement, dependency bundling) are enforced by the SDK and cannot be overridden.
Stubs.cs Polyfills
The SDK auto-includes Stubs.cs with polyfill types for modern C# features on netstandard2.0:
initsetters /recordtypes (C# 9)[ModuleInitializer],[SkipLocalsInit](C# 9)[CallerArgumentExpression](C# 10)- Interpolated string handlers (C# 10)
requiredmembers (C# 11)scoped refparameters (C# 11)- Nullable flow analysis attributes
All polyfills are guarded by #if !NET5_0_OR_GREATER and deactivate on modern targets.
Opt out: Set <ScribeSdkIncludeStubs>false</ScribeSdkIncludeStubs> if you provide your own.
Packaging
dotnet pack produces a correct analyzer NuGet package:
- Your analyzer DLL is placed in
analyzers/dotnet/cs/ - Private dependencies (like Scribe) are bundled alongside
- Roslyn SDK DLLs are excluded (provided by the compiler host)
LocalDev
The SDK includes LocalDev infrastructure for multi-repo development. See the main Scribe documentation for setup instructions.
Solution-Local Analyzers
For analyzers that live inside the same solution they serve, set ScribeSolutionAnalyzer=true to auto-pack on build with automatic version management:
<Project Sdk="BulletsForHumanity.Scribe.Sdk">
<PropertyGroup>
<ScribeSolutionAnalyzer>true</ScribeSolutionAnalyzer>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" />
<PackageReference Include="BulletsForHumanity.Scribe" PrivateAssets="all" />
</ItemGroup>
</Project>
Each build produces a unique timestamp version and a version override file, using the same mechanism as LocalDev but scoped to the solution. See Solution-Local Analyzers for the complete setup guide.
Links
Learn more about Target Frameworks and .NET Standard.
This package has 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.