OpenParable
Skip to content
← Back to skills

Dotnet Deploy

DevOps & Security
dotnet-deploy

Dotnet Deploy is an Agent Skill for devops & security published in the nixopus/nixopus repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Build and deploy .NET applications — ASP.NET Core, version detection, self-contained builds, and Dockerfile patterns. Use when deploying a .NET or C# project, or when a .csproj file is detected.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/nixopus/nixopus/blob/HEAD/api/skills/dotnet-deploy/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/dotnet-deploy, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

.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

PackagePurpose
libicu-devInternationalization support

Framework Detection

SignalFramework
Microsoft.AspNetCore.AppASP.NET Core
Microsoft.NET.Sdk.WebWeb SDK
Microsoft.NET.Sdk.WorkerWorker service
Microsoft.NET.SdkConsole / 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

RUN --mount=type=cache,target=/root/.nuget/packages \
    dotnet restore

Base Images

StageImage
Buildmcr.microsoft.com/dotnet/sdk:8.0 or mcr.microsoft.com/dotnet/sdk:8.0-alpine
Runtimemcr.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

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)

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)

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"]