Rocket.Surgery.Sdk.Script 2026.10.7

There is a newer version of this package available.
See the version list below for details.
<Sdk Name="Rocket.Surgery.Sdk.Script" Version="2026.10.7" />
                    
For projects that support Sdk, copy this XML node into the project file to reference the package.
#:sdk Rocket.Surgery.Sdk.Script@2026.10.7
                    
#:sdk directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.

Rocket.Surgery.Sdk

MSBuild project SDKs that distill the Rocket Surgeons Guild build conventions into a single versioned package family — compiler defaults, analyzers, standardized editorconfigs, NuGet audit, source link, and Microsoft.Testing.Platform test wiring.

Package Chains to Use for
Rocket.Surgery.Sdk Microsoft.NET.Sdk Libraries, console apps, file-based apps
Rocket.Surgery.Sdk.Web Microsoft.NET.Sdk.Web ASP.NET Core
Rocket.Surgery.Sdk.Razor Microsoft.NET.Sdk.Razor Razor class libraries
Rocket.Surgery.Sdk.BlazorWebAssembly Microsoft.NET.Sdk.BlazorWebAssembly Blazor WASM
Rocket.Surgery.Sdk.Test Microsoft.NET.Sdk Test projects (Microsoft.Testing.Platform)
Rocket.Surgery.Sdk.WindowsDesktop Microsoft.NET.Sdk.WindowsDesktop WPF / WinForms
Rocket.Surgery.Sdk.Script Microsoft.NET.Sdk File-based C# apps (#:sdk shorthand)

Requirements

.NET SDK 10 or later.

Usage

Pin the version once in global.json:

{
    "msbuild-sdks": {
        "Rocket.Surgery.Sdk": "2026.7.0",
        "Rocket.Surgery.Sdk.Test": "2026.7.0"
    }
}
<Project Sdk="Rocket.Surgery.Sdk">
    <PropertyGroup>
        <TargetFrameworks>net10.0;net11.0</TargetFrameworks>
    </PropertyGroup>
</Project>

Or inline: <Project Sdk="Rocket.Surgery.Sdk/2026.7.0">.

File-based C# apps (.NET 10+)

#:sdk Rocket.Surgery.Sdk@2026.7.0

Console.WriteLine("Hello");

File-based apps are detected automatically and get a relaxed analyzer profile.

What you get

  • LangVersion=preview, Features=strict, Nullable=enable, ImplicitUsings=enable, ProduceReferenceAssembly=true (unless it's a single-file app)
  • No default TargetFramework: a csproj sets TargetFramework or TargetFrameworks itself, as with Microsoft.NET.Sdk
  • AnalysisMode=AllEnabledByDefault, AnalysisLevel=latest, EnableNETAnalyzers=true
  • GenerateDocumentationFile=true for regular projects (off for test/sample/single-file-app projects)
  • Roslynator, BannedApiAnalyzers, PublicApiAnalyzers and Microsoft.CodeAnalysis.Analyzers injected (versions pinned by the SDK, individually overridable — see Injected package versions below)
  • Shared editorconfig profiles (common, coding style, JetBrains, Roslynator, tests, samples, file-based apps, per-SDK-variant) applied as global analyzer configs — your own .editorconfig always wins
  • NuGetAudit=true (mode all, level moderate)
  • Source link / deterministic CI builds auto-detected via ContinuousIntegrationBuild (GitHub Actions, Azure DevOps, GitLab CI env vars); build-provenance AssemblyMetadata (commit SHA, run/job/pipeline IDs, etc.) is embedded automatically on those providers
  • TreatWarningsAsErrors=true in CI and Release builds only; WarningsAsErrors always includes RS0017 (broken public API tracking)
  • A BannedSymbols.txt (and, if not disabled, BannedSymbols.NewtonsoftJson.txt) is wired up automatically
  • SBOM generation on pack, but only for packable projects in CI (Microsoft.Sbom.Targets, opt out with GenerateSBOM=false)
  • Package validation: set PackageValidationBaselineVersion to your last released version to turn on EnablePackageValidation
  • RollForward=LatestMajor for non-test executables; assemblies carry a RocketSurgery.Sdk.Name metadata attribute (when GenerateAssemblyInfo=true)
  • Source-linked, portable-PDB, symbol-package defaults (IncludeSymbols, SymbolPackageFormat=snupkg, DebugType=portable; EmbedUntrackedSources comes from the .NET SDK itself)
  • EmbeddedResourceUseDependentUponConvention=true for every target framework (the .NET SDK only does this for netcoreapp3.0+/netstandard2.1+), so resx manifest names stay stable on netstandard2.0 and .NET Framework
  • GitVersion integration: when GitVersion_* environment variables are present (e.g. dotnet-gitversion /output buildserver), they set Version, PackageVersion, AssemblyVersion (major only), FileVersion and InformationalVersion, and are stamped onto the assembly as AssemblyMetadata
  • JetBrains.Annotations.Sources injected (internal source, never exported) with a global using JetBrains.Annotations;
  • Publish/copy defaults: PublishRepositoryUrl, PublishDocumentationFile, PublishReferencesDocumentationFiles, PublishReferencesSymbols, CopyDebugSymbolFilesFromPackages, CopyDocumentationFilesFromPackages all default true
  • Applied editorconfigs/BannedSymbols are embedded into -bl binary logs for diagnosability
  • Opt-in runtime async for net11.0+ builds (RocketSurgeryRuntimeAsync=true)

Test projects

Use Rocket.Surgery.Sdk (or Rocket.Surgery.Sdk.Test, which also sets IsTestProject=true, UseMicrosoftTestingPlatformRunner=true and OutputType=Exe up front), then just reference your framework. Detection is automatic, based on your PackageReferences:

  • TUnit → Rocket.Surgery.Extensions.Testing.TUnit

Every test project also gets Microsoft.Testing.Extensions.CrashDump, HangDump, TrxReport, HotReload, AzureDevOpsReport and GitHubActionsReport on by default, plus CodeCoverage — with the matching command-line options wired through dotnet test automatically: crash/hang dumps (mini, 1-hour hang timeout), TRX reports, --report-azdo (Azure Pipelines) and --report-gh (GitHub Actions) — both are harmless no-ops outside their respective CI, and (once RsgSdk_Testing_Extensions is on) --minimum-expected-tests 1 so a run that discovers zero tests fails — set RsgSdk_Testing_MinimumExpectedTests=0 to disable. Coverage (cobertura, via the SDK's default coverage.runsettings, overridable with RunSettingsFilePath) is collected by default; set RsgSdk_Testing_CodeCoverage=false to disable it. HotReload activates via TESTINGPLATFORM_HOTRELOAD_ENABLED=1 (set automatically by dotnet watch), not a command-line flag, so there's nothing to wire for it beyond the package reference. Analyzers are skipped when compiling for dotnet test (RocketSurgeryOptimizeTestBuild=true to enable — it's opt-in). Microsoft.Testing.Extensions.Retry is opt-in too: set RsgSdk_Testing_Retry=true and RsgSdk_Testing_RetryCount to the number of retries.

Properties

All defaults are guarded (Condition="'$(Property)' == ''"), so anything set in your project, Directory.Build.props, or the command line always wins.

Analyzers (src/common/Analyzers.props)

Property Default Purpose
RocketSurgeryAnalyzers true Master switch for every analyzer package below
RocketSurgeryPublicApiAnalyzers true Inject Microsoft.CodeAnalysis.PublicApiAnalyzers
RocketSurgeryBannedApiAnalyzers true Inject Microsoft.CodeAnalysis.BannedApiAnalyzers + wire up BannedSymbols.txt
RocketSurgeryBannedNewtonsoftJson true Also wire up BannedSymbols.NewtonsoftJson.txt (requires RocketSurgeryBannedApiAnalyzers)
RocketSurgeryCodeAnalysisAnalyzers true Inject Microsoft.CodeAnalysis.Analyzers
RocketSurgeryRoslynatorAnalyzers true Inject Roslynator.Analyzers + Roslynator.Formatting.Analyzers
RocketSurgeryEditorConfig true Master switch for the shipped global editorconfig profiles
RocketSurgeryEditorConfigJetBrains true Include JetBrains.editorconfig
RocketSurgeryEditorConfigRoslynator true Include Roslynator.editorconfig
RocketSurgeryJetBrainsAnnotations true Inject JetBrains.Annotations.Sources + using JetBrains.Annotations; (C# only; independent of RocketSurgeryAnalyzers)

Editorconfig profiles are also applied automatically per project shape — Tests.editorconfig when IsTestProject=true, Samples.editorconfig when IsSampleProject=true, SingleFileApp.editorconfig when RocketSurgerySingleFileApp=true, and (if one exists) editorconfig/$(RocketSurgerySdkName).editorconfig per SDK variant — none of these have their own opt-out property beyond RocketSurgeryEditorConfig.

Compiler & analysis defaults (src/common/Common.props)

Property Default Condition
LangVersion preview —
Features strict —
Nullable enable —
ImplicitUsings enable —
ProduceReferenceAssembly true not a single-file app
AnalysisMode AllEnabledByDefault —
AnalysisLevel latest —
EnableNETAnalyzers true —
GenerateDocumentationFile true not a test, sample, or single-file-app project (flipped back to false for test/sample projects if it was this SDK that defaulted it)
NuGetAudit true —
NuGetAuditMode all —
NuGetAuditLevel moderate —
RocketSurgeryDefaultWarningsAsErrors true appends RS0017 to WarningsAsErrors
RocketSurgeryWarningsAsErrors true gates whether TreatWarningsAsErrors gets defaulted at all
TreatWarningsAsErrors true only when RocketSurgeryWarningsAsErrors=true and (ContinuousIntegrationBuild=true or Configuration=Release)
RocketSurgerySourceLink true gates the Source Link section below
RocketSurgerySingleFileApp true only when FileBasedProgram=true (file-based dotnet run app.cs apps)
IsTestProject / UseMicrosoftTestingPlatformRunner true only for Rocket.Surgery.Sdk.Test
OutputType Exe only for Rocket.Surgery.Sdk.Test, so restore fetches the apphost pack for older target frameworks
PublishRepositoryUrl true —
PublishDocumentationFile true —
PublishReferencesDocumentationFiles true —
PublishReferencesSymbols true —
CopyDebugSymbolFilesFromPackages true —
CopyDocumentationFilesFromPackages true —

IsSampleProject (default false, never set by the SDK — you opt in) relaxes packing, documentation, and RS0017 public-API tracking; see src/common/Common.targets.

Build/publish behavior (src/common/Common.targets)

Property Default Condition
RollForward LatestMajor OutputType=Exe and not a test project
GenerateSBOM true CI build and IsPackable=true (opt out with GenerateSBOM=false)
EnablePackageValidation true only once PackageValidationBaselineVersion is set to your last released version
IsPackable false test projects and sample projects
Features appends runtime-async=on only when RocketSurgeryRuntimeAsync=true, see Runtime async

Assemblies get a RocketSurgery.Sdk.Name metadata attribute whenever RocketSurgerySdkName is set (one fixed value per SDK package, e.g. Rocket.Surgery.Sdk.Web) and GenerateAssemblyInfo=true.

Runtime async

.NET 11 can run async methods on the runtime itself instead of compiler-generated state machines. It is off by default; set RocketSurgeryRuntimeAsync=true (in the project, Directory.Build.props, or on the command line) to turn on <Features>runtime-async=on</Features> for:

  • target frameworks compatible with net11.0. The flag breaks net10.0 builds (SYSLIB5007, CA2252), so a net10.0;net11.0 project only gets it on its net11.0 build;
  • non-browser targets only. net11.0-browser targets and anything built for the browser-wasm runtime identifier (Blazor WebAssembly included) never get it: Mono WebAssembly can't run runtime-async IL and fails with InvalidProgramException.
Property Default Purpose
RocketSurgeryRuntimeAsync (unset/off) opt-in: append runtime-async=on to Features for eligible target frameworks
UseRuntimeAsync (unset) set to false to opt a single project back out once the switch is on
Property Default
IncludeSymbols true
SymbolPackageFormat snupkg
DebugType portable

EmbeddedResourceUseDependentUponConvention defaults to true regardless of RocketSurgerySourceLink. EmbedUntrackedSources is not set by this SDK; the .NET SDK already defaults it to true.

GitVersion (src/common/GitVersion.props / GitVersion.targets)

Only active when the matching GitVersion_* variable is present, and never overrides a value you set. Opt out entirely with RocketSurgeryGitVersion=false.

Property Source
Version, PackageVersion GitVersion_SemVer
AssemblyVersion GitVersion_Major → <major>.0.0.0
FileVersion GitVersion_AssemblySemVer
InformationalVersion GitVersion_InformationalVersion
IncludeSourceRevisionInInformationalVersion false when GitVersion_InformationalVersion is set (it already contains the sha)

Every GitVersion_* variable is also added as AssemblyMetadata when GitVersion_SemVer is present.

Testing (src/common/Testing.props / Testing.targets, only imported for test projects)

Property Default Condition
RsgSdk_Testing_Extensions true master switch for everything below
RsgSdk_Testing_CodeCoverage true -
RsgSdk_Testing_TrxReport true —
RsgSdk_Testing_CrashDump true —
RsgSdk_Testing_HangDump true —
RsgSdk_Testing_HotReload true —
RsgSdk_Testing_AzureDevOpsReport true enables Microsoft.Testing.Extensions.AzureDevOpsReport + --report-azdo (no-op outside Azure Pipelines)
RsgSdk_Testing_GitHubActionsReport true enables Microsoft.Testing.Extensions.GitHubActionsReport + --report-gh (no-op outside GitHub Actions)
RsgSdk_Testing_Retry false opt-in — enables Microsoft.Testing.Extensions.Retry
RsgSdk_Testing_MinimumExpectedTests 0, raised to 1 raised to 1 only when RsgSdk_Testing_Extensions=true; set to 0 to disable the "zero tests discovered" failure
RsgSdk_Testing_RetryCount 0 only used when RsgSdk_Testing_Retry=true
RsgSdk_Testing_HangDumpTimeout 1h only when RsgSdk_Testing_Extensions=true
RocketSurgeryOptimizeTestBuild (unset/off) opt-in — set to true to skip analyzers when compiling for dotnet test
TestingPlatformDotnetTestSupport true —
MergeCoverage true —
IncludeTestAssembly true —
RunSettingsFilePath $(MSBuildThisFileDirectory)coverage.runsettings the SDK's own default runsettings; override to point at your own

Framework adapters (Rocket.Surgery.Extensions.Testing.TUnit) are added automatically by inspecting your PackageReferences (TUnit) — there is no property to force them on or off independently of RsgSdk_Testing_Extensions.

Injected package versions

There's no checked-in Packages.props to hand-maintain — common/Packages.props is generated at pack time (see src/Directory.Build.targets) from this repo's own Directory.Packages.props. Every PackageVersion / GlobalPackageReference whose package id starts with one of these prefixes is picked up automatically:

  • Rocket.Surgery.Extensions.
  • Microsoft.Testing.Extensions.
  • Roslynator
  • Microsoft.CodeAnalysis.
  • Microsoft.Sbom.Targets (exact match)
  • JetBrains.Annotations.Sources (exact match)

Adding a new package to that list is enough to make the SDK inject a version default for it — no manual property to add or keep in sync. The generated property name follows a fixed pattern: strip the dots from the package id and wrap it as RsgSdk_<PackageIdNoDots>_Version. For example:

Package Generated property
Roslynator.Analyzers RsgSdk_RoslynatorAnalyzers_Version
Microsoft.CodeAnalysis.PublicApiAnalyzers RsgSdk_MicrosoftCodeAnalysisPublicApiAnalyzers_Version
Microsoft.Testing.Extensions.CrashDump RsgSdk_MicrosoftTestingExtensionsCrashDump_Version
Rocket.Surgery.Extensions.Testing.TUnit RsgSdk_RocketSurgeryExtensionsTestingTUnit_Version

Every one of these is overridable the same way as any other SDK default — set the property in your project, Directory.Build.props, or on the command line before the SDK evaluates it. To see the full current list, either inspect common/Packages.props inside a packed nupkg, or run dotnet build -getProperty:RsgSdk_RoslynatorAnalyzers_Version (etc.) against a consumer project.

Continuous integration detection (src/common/ContinuousIntegration.props)

ContinuousIntegrationBuild is forced false during design-time builds; otherwise it's left for the normal SDK/CI-provider detection to set. When TF_BUILD, GITHUB_ACTIONS, or GITLAB_CI is present, the matching ci/*.targets file also adds provenance AssemblyMetadata items (commit SHA, run/job/pipeline/build IDs, repository info, etc.) pulled from that provider's environment variables.

Migrating a repo that used GlobalPackageReference for these analyzers? Remove those entries — the SDK injects them.

Migrating from Rocket.Surgery.MSBuild.*

The SDK replaces Rocket.Surgery.MSBuild.CI, .GitVersion, .SourceLink, .GlobalAnalyzerConfig, .JetBrains.Annotations and the Rocket.Surgery.MSBuild meta-package. Remove those GlobalPackageReferences, and Microsoft.SourceLink.* too: the .NET SDK bundles Source Link, and referencing the package switches the bundled copy off. AppVeyor detection was not carried over.

Rocket.Surgery.MyAssembly is now Rocket.Surgery.AssemblyInfo and ships from this repository (see AssemblyInfo below). It is opt-in, so reference it where you use it.

Renamed switches:

Rocket.Surgery.MSBuild.GlobalAnalyzerConfig Rocket.Surgery.Sdk
RSGEditorConfigEnabled RocketSurgeryEditorConfig
RSGRiderEnabled RocketSurgeryEditorConfigJetBrains
RSGRoslynatorEnabled RocketSurgeryEditorConfigRoslynator
RSGBannedApisEnabled RocketSurgeryBannedApiAnalyzers
RSGBannedNewtonsoftJsonEnabled RocketSurgeryBannedNewtonsoftJson
RSGSingleFileApp RocketSurgerySingleFileApp

Contributing

Run mise install before building: it installs the .NET SDK and the extra .NET 10 runtime that the net10.0 tests run on (.config/mise.toml). global.json pins the same SDK, so a dotnet outside mise fails fast unless that SDK is installed.

On macOS, the first mise install of a new .NET SDK can overwrite the shared ~/.local/share/mise/dotnet-root/dotnet host in place, and macOS then kills every dotnet command (SIGKILL). Replace the host with a fresh copy to fix it:

cd ~/.local/share/mise/dotnet-root && cp -p dotnet dotnet.fresh && mv -f dotnet.fresh dotnet

Versioning & releases

Versions follow <year>.<month>.<build> (e.g. 2026.7.1) and a release is published weekly by GitHub Actions using NuGet Trusted Publishing (OIDC — no API keys). One-time setup: on nuget.org, add a trusted publishing policy for RocketSurgeonsGuild/MSBuildSdk with workflow release.yml.

AssemblyInfo

Rocket.Surgery.AssemblyInfo (formerly Rocket.Surgery.MyAssembly) is a source generator that exposes build-time information as a generated AssemblyInfo class. It is not injected by the SDK:

<PackageReference Include="Rocket.Surgery.AssemblyInfo" PrivateAssets="all" />
Area Source
AssemblyInfo.Attributes.* assembly attributes (Title, Version, Company, …)
AssemblyInfo.Metadata.* @(AssemblyMetadata) items
AssemblyInfo.Project.* @(ProjectProperty) items (defaults include AssemblyName, RootNamespace, target framework and runtime identifiers)
AssemblyInfo.Git.* Branch, Commit, Sha, Root, Url
AssemblyInfo.Constants.* @(Constant) and @(FileConstant) items; dotted names (and a dotted Root) become nested classes
AssemblyInfo.Resources.* @(EmbeddedResource) items, as Text / GetBytes() / GetStream()
AssemblyInfo.Strings.* strings from .resx files
Property Default Purpose
AssemblyInfoNamespace (none) Namespace for the generated class (C# 10+)
AssemblyInfoVisibility internal Set to public to expose the class
AssemblyInfoGitComment (none) XML doc comment for the Git area

Diagnostics: RSAI001 (warning) when no Source Link provider is available, so Git.* values may be empty; RSAI002 (error) when AssemblyInfoNamespace is set on C# older than 10; RSAI003 (warning) when a .resx string mixes named ({name}) and indexed ({0}) format arguments, because no AssemblyInfo.Strings member is generated for it. RSAI001 and RSAI002 were TA001 and MA002 in MyAssembly, so update any suppressions.

Values and comments of @(Constant) items (and so of Project, Metadata, Attributes and Git) can hold any text: quotes and apostrophes, $, %, ;, backslashes and non-ASCII characters come out exactly as written. Every kind of line break (CRLF, LF, CR and the Unicode line and paragraph separators) becomes the build machine's newline, and the newlines at the very start and end of a value are dropped. To get the text across, the package's build targets compile a small inline MSBuild task (RoslynCodeTaskFactory, which the dotnet CLI and Visual Studio both provide), which adds about a quarter of a second to the first project built in an MSBuild process and a few milliseconds to each project after it.

Renamed from MyAssembly (the old names still work as fallbacks): MyAssemblyNamespace → AssemblyInfoNamespace, MyAssemblyVisibility → AssemblyInfoVisibility, MyAssemblyGitComment → AssemblyInfoGitComment; the generated class MyAssembly → AssemblyInfo, and its Info area → Attributes. Code that uses MyAssembly.* has to be updated.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.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
2026.11.4 46 11/16/2026
2026.11.2 92 11/7/2026
2026.11.2--no-branch-.1 51 11/7/2026
2026.11.0 104 11/2/2026
2026.10.7 106 10/31/2026
2026.10.6 108 10/31/2026
2026.10.5 103 10/28/2026
2026.10.3 108 10/22/2026
0.0.1 238 7/13/2026