Agent Skillsnixopus/nixopus › dotnet-deploy

dotnet-deploy

GitHub

提供.NET应用构建与部署指南,涵盖版本检测、Dockerfile模板及优化策略。

api/skills/dotnet-deploy/SKILL.md nixopus/nixopus

Trigger Scenarios

检测到.csproj文件 需要构建或发布.NET项目

Install

npx skills add nixopus/nixopus --skill dotnet-deploy -g -y
More Options

Non-standard path

npx skills add https://github.com/nixopus/nixopus/tree/master/api/skills/dotnet-deploy -g -y

Use without installing

npx skills use nixopus/nixopus@dotnet-deploy

指定 Agent (Claude Code)

npx skills add nixopus/nixopus --skill dotnet-deploy -a claude-code -g -y

安装 repo 全部 skill

npx skills add nixopus/nixopus --all -g -y

预览 repo 内 skill

npx skills add nixopus/nixopus --list

SKILL.md

Frontmatter
{
    "name": "dotnet-deploy",
    "metadata": {
        "version": "1.0"
    },
    "description": "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."
}

.NET Deployment

Detection

Project is .NET if a *.csproj file exists in the root.

Versions

  1. *.csprojTargetFramework (e.g. net8.0)
  2. global.jsonsdk.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.csprojMyApp)

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

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

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

Version History

  • cf05d97 Current 2026-08-20 14:51

Same Skill Collection

api/skills/api-catalog/SKILL.md
api/skills/caddyfile-generation/SKILL.md
api/skills/compose-setup/SKILL.md
api/skills/container-resource-tuning/SKILL.md
api/skills/cpp-deploy/SKILL.md
api/skills/database-migration/SKILL.md
api/skills/deno-deploy/SKILL.md
api/skills/deploy-delegation/SKILL.md
api/skills/deploy-flow/SKILL.md
api/skills/deployment-analysis/SKILL.md
api/skills/diagnostic-workflow/SKILL.md
api/skills/dockerfile-generation/SKILL.md
api/skills/dockerignore-generation/SKILL.md
api/skills/domain-attachment/SKILL.md
api/skills/domain-tls-routing/SKILL.md
api/skills/elixir-deploy/SKILL.md
api/skills/failure-diagnosis/SKILL.md
api/skills/github-onboarding/SKILL.md
api/skills/github-workflow/SKILL.md
api/skills/gleam-deploy/SKILL.md
api/skills/go-deploy/SKILL.md
api/skills/incident-response/SKILL.md
api/skills/java-deploy/SKILL.md
api/skills/machine-ops/SKILL.md
api/skills/mcp-integrations/SKILL.md
api/skills/monorepo-strategy/SKILL.md
api/skills/nixopus-docs/SKILL.md
api/skills/node-deploy/SKILL.md
api/skills/onboarding/SKILL.md
api/skills/php-deploy/SKILL.md
api/skills/post-deploy-verification/SKILL.md
api/skills/pre-deploy-checklist/SKILL.md
api/skills/python-deploy/SKILL.md
api/skills/rollback-strategy/SKILL.md
api/skills/ruby-deploy/SKILL.md
api/skills/rust-deploy/SKILL.md
api/skills/self-heal/SKILL.md
api/skills/shell-deploy/SKILL.md
api/skills/static-deploy/SKILL.md

Metadata

Files
0
Version
cf05d97
Hash
4d36dabf
Indexed
2026-08-20 14:51

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-31 02:06
浙ICP备14020137号-1 $Гость$