/net10-build:sdk-container-publishingfrom net10-build
Publishes .NET services as container images using dotnet publish /t:PublishContainer without a Dockerfile. Covers MSBuild properties, base-image inference, self-contained/AOT builds, and CI/CD publishing.
Ships in net10-build. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this skill when:
Do not use it when:
RUN step or arbitrary layer customization in the image. The SDK tooling cannot emulate RUN; write a Dockerfile instead.Since .NET 7, dotnet publish builds a container image natively. The Microsoft.NET.Build.Containers tooling ships with the SDK, so no Dockerfile is required and no Docker install is needed to produce an image. Docker or Podman is only required to run the image locally. This is documented in the containerize with dotnet publish tutorial.
The quickest path is one command:
dotnet publish /t:PublishContainer -c Release
That compiles the app and emits an image in one step. The image name defaults to the project's AssemblyName. Override it with ContainerRepository (renamed from ContainerImageName in earlier versions - see the sdk-container-builds customization notes).
The tooling writes the image in one of three ways. Pick based on where the image ends up.
| Mode | When to use |
|---|---|
| Local daemon (default) | Local dev. Pushes to the running Docker or Podman daemon with no extra config. |
| Tarball | You want a file to scan, transfer, or load later. Set ContainerArchiveOutputPath to a .tar.gz path, then docker load -i or podman load -i. Useful in security scanning workflows. |
| Registry push | Shipping. Set ContainerRegistry (for example ghcr.io or an internal registry) and the image is pushed directly. |
See the containerize a .NET app reference for the full property surface.
AssemblyName. Set ContainerRepository to override.mcr.microsoft.com/dotnet/runtime-deps, ASP.NET Core gets dotnet/aspnet, other apps get dotnet/runtime, tagged for the TFM. Since SDK 8.0.200 the inference is size and security aware: musl RIDs pick Alpine variants, PublishAot=true picks the chiseled AOT runtime-deps variant. See the base image inference notes.latest when you do not set a tag. If your publish relies on the version tag you must set ContainerImageTag (single tag) or ContainerImageTags (list) explicitly. This is a real footgun in CI - see the tag drift entry in references/troubleshooting.md.ContainerBaseImage to a specific nanoserver tag (for example mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-ltsc2022). See the Windows note.ContainerRuntimeIdentifiers (semicolon-delimited, a subset of RuntimeIdentifiers). The output is an OCI image index. Supported from SDK 8.0.405, 9.0.102, and 9.0.2xx onward.DOTNET_CONTAINER_INSECURE_REGISTRIES env var (comma-separated) starting in SDK 9.0.100. Since .NET 8.0.400 the SDK reads standard Docker / Podman config to decide HTTP vs HTTPS.Most of our services only override what they need and let the SDK infer the rest. A minimal csproj looks like this:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ContainerRepository>my-service</ContainerRepository>
<ContainerImageTags>$(VersionPrefix);latest</ContainerImageTags>
</PropertyGroup>
<ItemGroup>
<ContainerPort Include="8080" Type="tcp" />
</ItemGroup>
</Project>
Notes:
ContainerRegistry, no ContainerBaseImage, no ContainerUser. The SDK defaults these correctly for most ASP.NET services.ContainerPort items expose ports without a Dockerfile.latest - but only when $(VersionPrefix) is set before this file is evaluated (on the command line, in Directory.Build.props, or earlier in the project file). The SDK applies its 1.0.0 default after the project body, so a plain local publish resolves $(VersionPrefix) to empty and tags the image latest only. See the VersionPrefix ordering entry in references/troubleshooting.md.For the full property catalog, see references/property-reference.md.
In CI, publish against a registry and tag with the release name. The tag-driven pattern we use:
dotnet publish src/MyService/MyService.csproj \
-p:VersionPrefix=${{ github.ref_name }} \
-p:ContainerRegistry=docker.example.internal \
-c Release /t:PublishContainer
-p:VersionPrefix feeds the ContainerImageTags list set in the project, so the image is tagged with the release name and latest. Do not also pass -p:ContainerImageTag - the SDK rejects ContainerImageTag and ContainerImageTags together (CONTAINER2008). See references/ci-cd.md for the full workflow and registry auth notes.
If you centralize image settings across a repo, put them in a Directory.Build.props with CI conditionals. We do this for version tags and labels. See references/real-world-examples.md.
The common failures (tag drift, wrong image name or registry, unavailable RUN, no daemon on the build host, insecure registry rejection, multi-RID publish races, and multi-target publishing) are covered in depth in references/troubleshooting.md. In short: set your tag (ContainerImageTag or ContainerImageTags) explicitly, set ContainerRepository and ContainerRegistry explicitly, and use ContainerArchiveOutputPath when no daemon is available.
Symptom: Your pipeline publishes an image but you cannot find the version you expect, only latest.
Cause: Since .NET 8, when neither ContainerImageTag nor ContainerImageTags is set, the SDK tags the image latest instead of $(Version). VersionPrefix stamps the assembly version but not the image tag.
Fix: Set ContainerImageTag (single tag) or ContainerImageTags (list) explicitly in the publish step.
Symptom: The image pushes somewhere unexpected.
Cause: The SDK derives the repository name from AssemblyName and pushes to the local daemon by default.
Fix: Set ContainerRepository and ContainerRegistry explicitly.
RUN unavailableSymptom: You need to run a command inside the image and the SDK will not do it.
Cause: The SDK tooling cannot execute RUN steps without a Dockerfile.
Fix: Use a custom base image via ContainerBaseImage, or write a Dockerfile.
Symptom: Publishing fails because no Docker / Podman daemon is reachable.
Cause: The default output mode pushes to a local daemon, which must be present.
Fix: Set ContainerArchiveOutputPath to write a tarball instead. No daemon needed.
For more, see references/troubleshooting.md.
Self-contained projects default to the runtime-deps base image. AOT projects get a chiseled AOT runtime-deps variant for smaller, more secure images. See references/self-contained-and-aot.md.
Confirm the image built and exists:
# Image in the local daemon
docker images | grep <repository>
# Tarball produced
ls -la <ContainerArchiveOutputPath>
# Push succeeded (registry mode)
docker pull <ContainerRegistry>/<ContainerRepository>:<tag>
dotnet-skills:testcontainers - running containers in testsdotnet-skills:aot-trimming - AOT and trimming, relevant to base-image selectionWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
dotnet-publish, container-image, sdk-tooling, ci-cd-publishing
4 skills in this plugin
/convert-to-cpmConvert .NET projects and solutions (.sln, .slnx) to NuGet Central Package Management (CPM) using Directory.Packages.props. USE FOR: converting to CPM, centralizing or aligning NuGet package versions across multiple projects, inlining MSBuild version properties from Directory.Build.props into Directory.Packages.props, resolving version conflicts or mismatches across a solution or repository, updating or bumping or syncing package versions across projects. Also activate when packages are out of sync, drifting, or inconsistent -- even without the user mentioning CPM. Provides baseline build capture, version conflict resolution, build validation with binlog comparison, and a structured post-conversion report. DO NOT USE FOR: packages.config projects (must migrate to PackageReference first) or repositories that already have CPM fully enabled.
/directory-build-organizationUSE ONLY for (1) two or more projects with repeated MSBuild policy, targets, or package versions, or (2) an existing Directory.Build.props/targets/rsp hierarchy with an import, placement, or layering defect. A one-project repo without an existing Directory.Build file is outside scope; do not load this skill. Covers centralizing shared policy and targets, Directory.Packages.props across projects, parent hierarchy/import structure, props-versus-targets placement, and folder/project exceptions. An existing hierarchy defect remains in scope when only one project is affected. For property value or condition semantics use property-patterns. Exclude legacy-to-SDK migration and non-MSBuild systems./msbuildUse before MSBuild custom-target or incremental-generation repairs, XML/import/hook review, .binlog capture/replay, or assessing supported/unsupported build-speedup claims and controlled timings, even without a checkout. For MSBuild authoring itself, activate before reviewing/editing .proj/.props/.targets/.csproj/.fsproj/.vbproj or Directory.Build files, including no-change import reviews. Framework/API/.NET/ASP.NET upgrade plans and working non-SDK-to-SDK/packages.config conversions are migrations, even if they mention .csproj/NuGet: DO NOT activate. A failing assertion after a successful build is code/test debugging: DO NOT activate. Check Import/Exists, required and NuGet build/buildTransitive/nuspec imports, conditions, Inputs/Outputs, stale outputs and incorrect skips. Build checks use copies; source inputs stay read-only. Diagnose failed dotnet build/restore/pack/publish or slow evaluation/compilation/copying. Exclude SDK installation alone, C# refactoring, runtime CPU profiling and non-MSBuild builds.npx claudepluginhub codehepta/net10-skills --plugin net10-build2 plugins ship this exact skill · first indexed Oct 11, 2026
Other plugins' skills for the same job