dotnet-run-file

Execute C# scripts directly with dotnet run file.cs and stdin input.

137|20|Updated Jun 13, 2025
One-click install
npx skills add https://github.com/NikiforovAll/claude-code-rules --skill dotnet-run-file
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-run-file
Source: https://github.com/NikiforovAll/claude-code-rules/tree/main/plugins/handbook-dotnet/skills/dotnet-run-file
Command: npx skills add https://github.com/NikiforovAll/claude-code-rules --skill dotnet-run-file

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill lets you run C# code without creating a project, using dotnet run file.cs, and supports one-liners from stdin and run-file directives to keep workflows lightweight.

Core Features & Use Cases

  • One-file scripting: Run C# code directly without a project.
  • stdin execution: Pipe one-liners or small scripts into dotnet run -.
  • Run-file directives: Use #:package, #:sdk, #:property to tailor builds.
  • Conversion: Convert run files to a full project when needed.

Quick Start

Run a file and a stdin example: dotnet run app.cs echo 'Console.WriteLine("Hello");' | dotnet run -

Frequently Asked Questions about dotnet-run-file

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run C# code without creating a project file?

Run C# code directly using dotnet run file.cs, which executes scripts without requiring a project structure. This approach supports top-level statements and run-file directives like #:package and #:sdk to manage dependencies and build settings inline.

Can I pipe C# scripts into dotnet run from stdin?

Yes, dotnet run accepts stdin input via the dash operator: echo 'Console.WriteLine("Hello");' | dotnet run -. This enables one-liner execution and heredoc multi-line input for quick scripting workflows.

What run-file directives does dotnet run support?

Run-file directives include #:package to add NuGet dependencies, #:sdk to specify the .NET SDK version, and #:property to configure build properties. These directives must appear at the top of the file and tailor the build without a project file.

How do I convert a C# run file into a full project?

Convert a run file to a complete project by extracting the script content and directives into a proper .csproj structure with separate source files. This transition is needed when moving from quick prototyping to maintainable project workflows.

Does dotnet run file support project references?

Yes, the Skill manages project references through run-file directives and component support, allowing scripts to reference external assemblies and dependencies defined in the build configuration.