dotnet-file-based-apps

Create and run .NET applications from single C# source files.

Updated Jan 7, 2026
One-click install
npx skills add https://github.com/lbussell/agent-skills --skill dotnet-file-based-apps
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-file-based-apps
Source: https://github.com/lbussell/agent-skills/tree/main/skills/dotnet-file-based-apps
Command: npx skills add https://github.com/lbussell/agent-skills --skill dotnet-file-based-apps

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies the development of small .NET applications, scripts, and utilities by allowing them to be built and run from a single C# file, eliminating the need for traditional project files (.csproj).

Core Features & Use Cases

  • Single-File Development: Write, compile, and run .NET code from one .cs file.
  • Directives: Use #: directives to manage NuGet packages, project references, and build properties.
  • Native AOT: Compiles to optimized, self-contained executables by default.
  • Use Case: Quickly create a command-line tool to automate a repetitive task, like renaming files in a directory, without the overhead of setting up a full Visual Studio project.

Quick Start

Create a file named hello.cs with the content using System; Console.WriteLine("Hello, World!"); and run it using the command dotnet run hello.cs.

Frequently Asked Questions about dotnet-file-based-apps

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

FAQPage Schema
How do I run a single C# file without creating a .NET project?

You can run a single C# file directly using the `dotnet run hello.cs` command, bypassing the need for traditional `.csproj` project files. This approach simplifies building small .NET applications, scripts, and utilities by compiling and executing the code from one file.

Can I use NuGet packages in a C# script without a project file?

Yes, you can manage NuGet packages in a C# script without a project file by using `#:` directives directly within the single `.cs` source file. This allows you to include package references, project references, and build properties seamlessly.

Does .NET single-file execution support Native AOT compilation?

Yes, .NET single-file execution supports Native AOT compilation, compiling scripts into optimized, self-contained executables by default. This feature enables efficient script and utility development without the overhead of a traditional project setup.

What is the best way to build a quick command-line utility in C#?

The best way to build a quick command-line utility in C# is using single-file development to write, compile, and run code from one `.cs` file. This eliminates the overhead of setting up a full Visual Studio project for automating repetitive tasks.

Do I need Visual Studio to automate a repetitive task with a C# script?

No, you do not need Visual Studio to automate tasks with a C# script. You can write a single `.cs` file with standard C# code and execute it directly using the .NET CLI, avoiding the overhead of a full project setup.

What are the limitations of building .NET apps from single C# files?

Building .NET apps from single C# files is designed for small applications, scripts, and utilities, and may not suit large-scale enterprise architectures. It uses `#:` directives for package management and Native AOT compilation, focusing on lightweight script development rather than complex project structures.