How to Deploy Applications Using dotnet/skills: A Complete Guide to Automated .NET Deployment
Deploy .NET applications using dotnet/skills by running declarative skill plugins that automate project migration, containerization, and cloud deployment to Azure Container Apps or MCP registries.
The dotnet/skills repository provides a collection of skill plugins that automate end-to-end .NET developer workflows, from upgrading target frameworks to publishing containerized applications. When you deploy applications using dotnet/skills, the engine executes declarative workflows defined in SKILL.md files, handling everything from global.json updates to Azure resource provisioning. This approach eliminates manual configuration errors by treating deployment steps as version-controlled, reproducible automation.
Understanding the dotnet/skills Deployment Architecture
The deployment capabilities in dotnet/skills rely on a modular architecture where markdown-based skill definitions drive the automation engine.
Core Components
- Skill definitions (
SKILL.md): These markdown files declare inputs, step-by-step workflows, and command sequences that the engine executes. The migration skill atplugins/dotnet-upgrade/skills/migrate-dotnet8-to-dotnet9/SKILL.mdand the publishing skill atplugins/dotnet-ai/skills/mcp-csharp-publish/SKILL.mdcontain the actual deployment logic. - Reference documentation (
references/*.md): Dynamic guidance files loaded during execution to provide breaking-change details or platform-specific configuration. For example,plugins/dotnet-upgrade/skills/migrate-dotnet8-to-dotnet9/references/deployment-runtime-dotnet8to9.mdcontains runtime-specific deployment changes. - Engine core: Implemented in
eng/skill-validator/src/SkillValidator.csproj, this component parses skill markdown, resolves input variables, executes CLI commands (dotnet, Docker, Azure CLI), and tracks execution progress. - CI/CD integration: Skills automatically update
global.json, Dockerfiles, and pipeline YAML files during execution, ensuring your infrastructure stays synchronized with your code changes.
How the Engine Executes Deployments
- Input collection: You invoke a skill via the CLI (e.g.,
dotnet skills run migrate-dotnet8-to-dotnet9) and provide project paths and target destinations. - Workflow execution: The engine reads the skill's markdown, substitutes variables, and runs commands sequentially.
- Reference loading: When steps require detailed guidance, the engine loads reference files to apply automatic edits like Docker base-image bumps or SDK version updates.
- Idempotent commits: Changes are grouped into logical commits (TFM migration, build fixes, infrastructure updates) for clean history and rollback capability.
Step-by-Step Deployment Workflow
Deploying a .NET 9 application to Azure Container Apps requires running two primary skills: one to upgrade your project and another to package and deploy it.
Upgrade and Prepare Your Project
Before deployment, ensure your application targets the latest runtime using the migration skill:
dotnet skills run migrate-dotnet8-to-dotnet9 \
--project ./src/MyWebApi/MyWebApi.csproj
This skill executes the following actions defined in plugins/dotnet-upgrade/skills/migrate-dotnet8-to-dotnet9/SKILL.md:
- Lines 50-58: Detects SDK version and technology stack (ASP.NET Core, EF Core, Dockerfile presence)
- Lines 66-74: Updates
<TargetFramework>fromnet8.0tonet9.0in the project file - Lines 77-81: Bumps package references to
9.0.xand runsdotnet restore - Lines 102-125: Applies source-compatible fixes for breaking changes (e.g.,
BinaryFormatterremoval) - Lines 174-196: Updates Docker base images and CI pipeline SDK versions
- Lines 200-215: Executes clean build and test validation
Containerize and Package
After migration, use the MCP publishing skill to create a production container image:
dotnet skills run mcp-csharp-publish \
--transport http \
--project ./src/MyWebApi/MyWebApi.csproj \
--target-destination azure
According to plugins/dotnet-ai/skills/mcp-csharp-publish/SKILL.md, this skill performs:
- Lines 174-182: Generates a Dockerfile targeting
mcr.microsoft.com/dotnet/aspnet:9.0 - Lines 38-43: Builds the container image with
docker build - Lines 48-55: Pushes the image to Azure Container Registry
- Lines 85-95: Optionally publishes server descriptors to the MCP Registry
Deploy to Azure Container Apps
The final phase provisions cloud resources using the Azure CLI commands embedded in the skill:
- Lines 60-70: Executes
az containerapp createwith configurable replica counts, secrets, and environment variables - Lines 33-35: Injects health-check endpoints into the Dockerfile for runtime validation
Key Source Files and Implementation Details
Understanding these specific files helps you customize or troubleshoot deployments:
| File Path | Purpose |
|---|---|
plugins/dotnet-upgrade/skills/migrate-dotnet8-to-dotnet9/SKILL.md |
Contains the complete migration workflow including Docker base-image updates and CI script modifications |
plugins/dotnet-upgrade/skills/migrate-dotnet8-to-dotnet9/references/deployment-runtime-dotnet8to9.md |
Detailed breaking-change list for runtime and deployment configuration |
plugins/dotnet-ai/skills/mcp-csharp-publish/SKILL.md |
End-to-end publishing workflow for HTTP MCP servers including Docker builds and Azure deployment |
plugins/dotnet-ai/skills/mcp-csharp-publish/references/docker-azure.md |
Production Dockerfile patterns and Azure Container Apps configuration reference |
eng/skill-validator/src/SkillValidator.csproj |
The core engine implementation that parses skill markdown and executes scripted steps |
Complete Code Examples for Deployment
Generated Dockerfile
The mcp-csharp-publish skill generates optimized Dockerfiles targeting .NET 9:
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
COPY --from=build /app .
# Non-root user for security
RUN adduser --disabled-password --gecos '' appuser
USER appuser
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
ENTRYPOINT ["dotnet", "MyWebApi.dll"]
Source: plugins/dotnet-ai/skills/mcp-csharp-publish/SKILL.md, lines 14-31.
Azure Container Apps CLI Command
The skill executes the following Azure CLI command to provision resources:
az containerapp create \
--name mywebapi \
--resource-group my-rg \
--environment my-env \
--image myregistry.azurecr.io/mywebapi:1.0.0 \
--target-port 8080 \
--ingress external \
--min-replicas 0 \
--max-replicas 10 \
--secrets api-key=$MY_API_KEY \
--env-vars API_KEY=secretref:api-key
Source: plugins/dotnet-ai/skills/mcp-csharp-publish/SKILL.md, lines 60-70.
Project Configuration Updates
The migration skill automatically updates your project file:
<!-- Before -->
<TargetFramework>net8.0</TargetFramework>
<!-- After -->
<TargetFramework>net9.0</TargetFramework>
Source: plugins/dotnet-upgrade/skills/migrate-dotnet8-to-dotnet9/SKILL.md, lines 66-74.
CI/CD SDK Version Pinning
The skill updates global.json to ensure build consistency:
{
"sdk": {
"version": "9.0.100",
"rollForward": "latestFeature"
}
}
Source: plugins/dotnet-upgrade/skills/migrate-dotnet8-to-dotnet9/SKILL.md, lines 84-92.
Summary
- dotnet/skills automates deployment through declarative
SKILL.mdfiles that the engine executes sequentially. - Run
migrate-dotnet8-to-dotnet9to upgrade projects, fix breaking changes, and update Docker base images before deployment. - Use
mcp-csharp-publishto containerize applications and deploy to Azure Container Apps with a single command. - All deployment logic is self-documenting and version-controlled, automatically updating
global.json, Dockerfiles, and CI pipelines. - The engine produces idempotent commits, allowing you to review, modify, or rollback deployment changes through standard git workflows.
Frequently Asked Questions
What is the dotnet/skills engine and how does it handle deployment?
The dotnet/skills engine is a parser and executor implemented in eng/skill-validator/src/SkillValidator.csproj that reads markdown-based skill definitions and runs the embedded CLI commands. For deployment scenarios, it orchestrates dotnet CLI builds, Docker image creation, and Azure resource provisioning by following the step-by-step workflows defined in each skill's SKILL.md file.
Can I deploy to platforms other than Azure Container Apps?
Yes, while the mcp-csharp-publish skill specifically targets Azure Container Apps as shown in plugins/dotnet-ai/skills/mcp-csharp-publish/SKILL.md, the skill architecture supports extensible targets. The Docker image generation steps (lines 174-182) create standard OCI-compliant images that can run on any container platform, including Kubernetes, Docker Hub, or AWS ECS, though you may need to modify the final provisioning steps for non-Azure targets.
How does the migration skill handle breaking changes during deployment preparation?
The migration skill loads reference documentation dynamically from references/deployment-runtime-dotnet8to9.md when executing steps 7-9 of the workflow (lines 102-125 in SKILL.md). This allows the skill to apply specific fixes for source-incompatible changes—such as removing deprecated APIs or adjusting to new runtime behaviors—automatically during the upgrade process before the application reaches the deployment stage.
Are the deployment changes committed automatically or can I review them first?
The skill engine creates idempotent commits that group changes logically (TFM updates, build fixes, infrastructure changes) as specified in the skill markdown. This produces a clean git history that you can review, amend, or reject before pushing to your repository, ensuring you maintain full control over what gets deployed to production environments.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →