Run script-like CSharp programs using dotnet run file.cs. Use this skill when users want to execute CSharp code directly, write one-liner scripts via stdin, or learn about run file directives.
Run C# code directly without creating project files using .NET 10's dotnet run file.cs feature.
Use this skill when the user wants to:
#:package, #:sdk, #:property)For detailed examples and directives reference, load references/guide.md.
# Run a .cs file
dotnet run app.cs
# Run from stdin
echo 'Console.WriteLine("Hello");' | dotnet run -
# Multi-line via heredoc
dotnet run - << 'EOF'
var now = DateTime.Now;
Console.WriteLine($"Time: {now}");
EOF
#:package Humanizer@* // NuGet package (version required, wildcards ok)
#:sdk Microsoft.NET.Sdk.Web // SDK selection
#:property LangVersion preview // MSBuild property
#:project ../src/MyLib // Project reference
dotnet project convert app.cs
Steps:
.cs file with your code (top-level statements supported)dotnet run filename.csExample:
// hello.cs
Console.WriteLine("Hello from .NET!");
dotnet run hello.cs
Purpose: Run C# code without creating files - ideal for quick scripts and AI-assisted workflows.
Patterns:
# Simple one-liner
echo 'Console.WriteLine(Math.PI);' | dotnet run -
# With package
dotnet run - << 'EOF'
#:package Humanizer@*
using Humanizer;
Console.WriteLine(TimeSpan.FromMinutes(90).Humanize());
EOF
# Heredoc for multi-line
dotnet run - << 'EOF'
using System.Text.Json;
var obj = new { Name = "Test", Value = 42 };
Console.WriteLine(JsonSerializer.Serialize(obj));
EOF
When user asks to run C# code without specifics:
.cs fileFor AI-assisted workflows:
dotnet run script.cs | jq .npx skills add NikiforovAll/dotnet-run-file下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer