dotnet-deploy
The dotnet-deploy skill automates building and deploying .NET applications by detecting project files, determining framework versions, executing restore and publish commands, and generating Dockerfile patterns. Use this when deploying .NET or C# projects containing .csproj files, supporting ASP.NET Core web apps, worker services, console applications, and self-contained deployments with proper port binding and multi-stage Docker builds.
git clone --depth 1 https://github.com/nixopus/nixopus /tmp/dotnet-deploy && cp -r /tmp/dotnet-deploy/api/skills/dotnet-deploy ~/.claude/skills/dotnet-deploySKILL.md
# .NET Deployment
## Detection
Project is .NET if a `*.csproj` file exists in the root.
## Versions
1. `*.csproj` → `TargetFramework` (e.g. `net8.0`)
2. `global.json` → `sdk.version`
3. Defaults to **8.0**
## Build
### Build Process
1. Restore: `dotnet restore`
2. Publish: `dotnet publish --no-restore -c Release -o out`
3. Output: `./out/<project_name>.dll` or `./out/<project_name>.exe`
### Start Command
- `./out/<project_name>` or `dotnet ./out/<project_name>.dll`
- Project name from `*.csproj` filename (e.g. `MyApp.csproj` → `MyApp`)
## Port Binding
```
ASPNETCORE_URLS=http://0.0.0.0:${PORT:-3000}
```
Ensures the app listens on all interfaces.
## Runtime Packages
| Package | Purpose |
|---|---|
| `libicu-dev` | Internationalization support |
## Framework Detection
| Signal | Framework |
|---|---|
| `Microsoft.AspNetCore.App` | ASP.NET Core |
| `Microsoft.NET.Sdk.Web` | Web SDK |
| `Microsoft.NET.Sdk.Worker` | Worker service |
| `Microsoft.NET.Sdk` | Console / class library |
## Install Stage Optimization
Copy project files first for layer caching:
- `*.csproj`, `*.sln`
- `global.json`, `nuget.config`, `Directory.Build.props`, `Directory.Packages.props`
- Then `src/`
## Caching
```dockerfile
RUN --mount=type=cache,target=/root/.nuget/packages \
dotnet restore
```
## Base Images
| Stage | Image |
|---|---|
| Build | `mcr.microsoft.com/dotnet/sdk:8.0` or `mcr.microsoft.com/dotnet/sdk:8.0-alpine` |
| Runtime | `mcr.microsoft.com/dotnet/aspnet:8.0` or `mcr.microsoft.com/dotnet/runtime:8.0` |
Use ASP.NET runtime for web apps; `runtime` for console/worker.
## Dockerfile Patterns
### ASP.NET Core
```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
COPY . .
RUN dotnet publish --no-restore -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app/out .
ENV ASPNETCORE_URLS=http://0.0.0.0:3000
EXPOSE 3000
ENTRYPOINT ["dotnet", "MyApp.dll"]
```
### Multi-project (sln)
```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
COPY *.sln ./
COPY src/ ./src/
RUN dotnet restore
RUN dotnet publish src/MyApp/MyApp.csproj --no-restore -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app/out .
ENV ASPNETCORE_URLS=http://0.0.0.0:3000
EXPOSE 3000
ENTRYPOINT ["dotnet", "MyApp.dll"]
```
### Self-contained (single binary)
```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
COPY . .
RUN dotnet publish --no-restore -c Release -o out -r linux-x64 --self-contained true -p:PublishSingleFile=true
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0
WORKDIR /app
COPY --from=build /app/out .
ENV ASPNETCORE_URLS=http://0.0.0.0:3000
EXPOSE 3000
ENTRYPOINT ["./MyApp"]
```Reference for all Nixopus API operations callable via nixopus_api(method, path, body)
Generate Caddyfile configurations for static sites and reverse proxies — SPA fallback routing, cache headers, compression, redirects, and error pages. Use when deploying a static site that needs custom Caddy configuration, or when the user needs SPA routing, caching, or redirect rules.
Generate docker-compose.yml for multi-service setups including databases, caches, and service dependencies. Use when the app needs a database, cache, message broker, or has multiple independently deployable services.
Size container memory and CPU limits, diagnose OOM kills and CPU throttling, and recommend resource adjustments by ecosystem. Use when containers are being OOM-killed, running slowly, or when setting initial resource limits for a deployment.
Build and deploy C/C++ applications — CMake, Meson, Ninja, and Dockerfile patterns. Use when deploying a C or C++ project, or when CMakeLists.txt or meson.build is detected.
Run database migrations safely during deployment — framework-specific commands, pre-deploy vs post-deploy timing, health gates, and rollback strategies. Use when the app has a database migration system and needs migrations run during deployment.
Build and deploy Deno applications — version detection, dependency caching, and Dockerfile patterns. Use when deploying a Deno project, or when deno.json or deno.jsonc is detected.
Sub-agent routing table — which agent handles diagnostics, machine health, infrastructure, GitHub, billing, and notifications. Load when the current task is not a direct deployment.