dotnet-file-based-apps

Run, build, and publish C# code from a single .cs file using .NET SDK.

71|10|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-file-based-apps-wshaddix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-file-based-apps
Source: https://github.com/wshaddix/dotnet-skills/tree/main/skills/dotnet-file-based-apps
Command: npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-file-based-apps-wshaddix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill allows developers to run, build, and publish C# applications directly from a single .cs file, eliminating the need for traditional .csproj project files for simple scripts and utilities.

Core Features & Use Cases

  • Simplified Development: Write and execute C# code without the overhead of project file creation.
  • Directive-Based Configuration: Use #: directives within the code file to specify package references, SDKs, and build properties.
  • Use Case: Quickly prototype a C# utility script that fetches data from an API and logs it, without needing to set up a full project structure.

Quick Start

Execute the C# code in the file 'my_script.cs' using the dotnet CLI.

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

You can run C# code directly from a single .cs source file using the .NET SDK's file-based application feature, eliminating the need to create a traditional .csproj project file for script execution.

How do I add NuGet package references to a C# script?

You can add package references to a C# script by using embedded `#:` directives within the source file. This directive-based configuration manages packages, SDK selection, and MSBuild properties directly in the code.

What are file-based apps in .NET used for?

File-based apps in .NET are used for rapid scripting, utility development, and small application deployment. They simplify development by letting you execute C# code without the overhead of setting up a full project structure.

Do I need a .csproj file to build and publish a C# utility script?

No, you do not need a .csproj file to build and publish simple C# utilities. The .NET SDK file-based application feature supports building and publishing directly from a single .cs source file.

Can I specify MSBuild properties in a file-based C# application?

Yes, you can specify MSBuild properties in a file-based C# application by using embedded `#:` directives within the source code file. This allows configuration of SDK selection and build properties without a project file.