csharp-scripts

Runs file-based C# apps with the .NET CLI without creating a project.

Updated Jul 20, 2026
One-click install
npx skills add https://github.com/Netcodr81/kinetic-reports --skill csharp-scripts-netcodr81
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: csharp-scripts
Source: https://github.com/Netcodr81/kinetic-reports/tree/main/.github/skills/csharp-scripts
Command: npx skills add https://github.com/Netcodr81/kinetic-reports --skill csharp-scripts-netcodr81

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing and running quick C# experiments normally requires creating a full .NET project with a .csproj file, which adds overhead for one-off tests, API experiments, and small utilities. This Skill lets you run single-file or small multi-file C# apps directly with the .NET CLI. ## Core Features & Use Cases - File-Based App Execution: Run a single .cs file with top-level statements using dotnet hello.cs, with no project file required. - Inline Directives: Add NuGet packages, MSBuild properties, SDK selection, project references, and multi-file includes via #:package, #:property, #:sdk, #:project, #:ref, #:include, and #:exclude directives. - Version-Aware Guidance: Checks the .NET SDK version and falls back to a temporary console project on .NET 9 and earlier. - Use Case: You want to test how System.Text.Json source generation behaves under native AOT. Write one .cs file with a JsonSerializerContext, run it directly, and clean up afterward without ever creating a project. ## Quick Start Ask the AI to write and run a quick file-based C# app that tests a specific API or language feature without creating a project.

Frequently Asked Questions about csharp-scripts

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

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

Use file-based apps in .NET 10 or later: write a .cs file with top-level statements and run it with `dotnet hello.cs`. The CLI builds and runs the file directly, caching the build so subsequent runs are fast.

How do I add a NuGet package to a file-based C# app?▼

Add a `#:package` directive at the top of the file, before any using directives, with an explicit version such as `#:package Humanizer@2.14.1`. Use `@*` for the latest version or `@*-*` to include pre-release versions.

Does file-based C# work on .NET 9 or earlier?▼

No, file-based apps require .NET SDK 10 or later, and multi-file directives like #:include require SDK 10.0.300 or later. On older SDKs, create a temporary console project with `dotnet new console` and run it with `dotnet run`.

What is the difference between #:include and #:ref in C# file-based apps?▼

#:include compiles helper files into the same assembly as the entry point, while #:ref compiles the referenced file as a separate project with an assembly boundary. Use #:ref when you need project-reference-like separation and public-only visibility.

Why does JsonSerializer fail in a file-based C# app?▼

File-based apps enable native AOT by default, so reflection-based JsonSerializer calls fail at runtime. Use source-generated serialization with a JsonSerializerContext partial class annotated with JsonSerializable attributes.

When should I convert a file-based C# app to a full project?▼

Convert when the app needs build customization, tests, publish configuration, or integration into an existing solution. Run `dotnet project convert hello.cs` to generate a full project from the file-based app.