dotnet-file-based-apps

Build and run C# file-based apps using dotnet CLI directives.

Updated Aug 16, 2025
One-click install
npx skills add https://github.com/dodyg/blue-nile-pds --skill dotnet-file-based-apps-dodyg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-file-based-apps
Source: https://github.com/dodyg/blue-nile-pds/tree/main/.agents/skills/dotnet-file-based-apps
Command: npx skills add https://github.com/dodyg/blue-nile-pds --skill dotnet-file-based-apps-dodyg

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill explains how to build, run, and publish .NET 10 file-based C# applications from a single source file so you can avoid creating and maintaining a .csproj for small utilities, scripts, and one-off tools while preserving package and SDK configuration via top-of-file directives.

Core Features & Use Cases

  • Directive-driven configuration: Use top-of-file directives to declare NuGet packages, SDK selection, MSBuild properties, and project references without a .csproj.
  • CLI-first workflow: Run, build, restore, clean, and publish single-file apps using familiar dotnet commands and control caching, outputs, and launch profiles.
  • Migration and distribution: Publish native AOT artifacts by default, pack as a .NET tool, and convert a file-based app into a full .csproj when the app grows beyond a single file.
  • Use Case: Quickly create a small command-line tool that references Serilog via a package directive, run it locally with dotnet run, then publish a native AOT executable for distribution.

Quick Start

Run the file-based C# source file using the .NET 10 SDK, ensure all #: directives appear at the top of the file, and publish a native AOT build when ready.

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 C# script from a single file without a csproj?

You can run C# file-based apps without a .csproj by using top-of-file directives like #:package, #:sdk, and #:property to declare dependencies, then executing the file with the dotnet CLI.

What are file-based apps in .NET 10?

File-based apps in .NET 10 are single C# source files that use #:project and #:package directives to configure NuGet packages and SDK settings, eliminating the need to maintain a separate .csproj file.

Can I publish a single-file C# app as a native AOT executable?

Yes, you can publish single-file C# apps as native AOT executables by default using dotnet CLI commands, allowing you to distribute compiled binaries without requiring a full project structure.

How do I add NuGet packages to a file-based C# application?

You add NuGet packages to a file-based C# application by using the #:package directive at the top of your source file, which the SDK parses to restore dependencies during dotnet run or build.

When should I convert my file-based C# app to a csproj?

You should convert your file-based C# app to a .csproj when the application grows beyond a single file, requiring a full project structure to manage multiple source files and complex configurations.

Does the dotnet CLI support building single-file C# scripts with custom MSBuild properties?

Yes, the dotnet CLI supports building single-file C# scripts with custom MSBuild properties by using the #:property directive at the top of the file to configure build settings without a .csproj.