| name | dotnet-file-based-apps |
| category | developer-experience |
| subcategory | cli |
| description | Builds .NET 10 file-based C# apps. Directives, CLI commands, csproj migration. |
| license | MIT |
| targets | ["*"] |
| tags | ["foundation","dotnet","skill"] |
| version | 0.0.1 |
| author | dotnet-agent-harness |
| invocable | true |
| claudecode | {"allowed-tools":["Read","Grep","Glob","Bash","Write","Edit"]} |
| codexcli | {"short-description":".NET skill guidance for foundation tasks"} |
| opencode | {"allowed-tools":["Read","Grep","Glob","Bash","Write","Edit"]} |
| copilot | {} |
| geminicli | {} |
| antigravity | {} |
dotnet-file-based-apps
.NET 10 SDK file-based apps let you build, run, and publish C# applications from a single .cs file without creating a
.csproj project file. The SDK auto-generates project configuration from #: directives embedded in the source file.
This feature targets scripts, utilities, and small applications where traditional project scaffolding is unnecessary.
This is NOT file I/O. For FileStream, RandomAccess, FileSystemWatcher, and path handling, see
[skill:dotnet-file-io].
Prerequisites: Requires .NET 10 SDK or later. Run [skill:dotnet-version-detection] to confirm SDK version.
Cross-references: [skill:dotnet-version-detection] for SDK version gating, [skill:dotnet-project-analysis] for
project-based analysis (file-based apps have no .csproj), [skill:dotnet-scaffold-project] for csproj-based project
scaffolding.
Scope
- #: directives (package, sdk, property, project)
- CLI commands for file-based apps (dotnet run, dotnet publish)
- Migration from file-based to .csproj project format
Out of scope
- File I/O (FileStream, RandomAccess, paths) -- see [skill:dotnet-file-io]
- Project-based .csproj scaffolding -- see [skill:dotnet-scaffold-project]
- Solution structure analysis -- see [skill:dotnet-project-analysis]
Directives Overview
File-based apps use #: directives to configure the build. Directives are SDK-level instructions, not C# syntax.
They must appear at the top of the .cs file, before any C# code.
Four directive types are supported:
| Directive | Purpose | Example |
|---|
#:package | Add a NuGet package reference | #:package Serilog@3.1.1 |
#:sdk | Set the SDK (default: Microsoft.NET.Sdk) | #:sdk Microsoft.NET.Sdk.Web |
#:property | Set an MSBuild property | #:property PublishAot=false |
#:project | Reference another project file | #:project ../Lib/Lib.csproj |