NetFabric/NetFabric.Numerics / .agents/skills/csharp-file-based-app
csharp-file-based-app
VerifiedBuild, run, and publish .NET applications from a single C# file without a .csproj, using .NET 10 SDK file-based apps. USE FOR: dotnet run file.cs; dotnet run --file; shebang/shell-executable C# scripts; colon-prefixed directives (sdk, package, project, property, include); converting a file-based app to a project with dotnet project convert; publishing file-based apps with native AOT; packaging a file-based app as a .NET tool (PackAsTool); user secrets for file-based apps; flat *.run.json launch profiles; dotnet build/clean/publish/pack/restore on a .cs file; build caching behavior and dotnet clean file-based-apps; folder layout to avoid project-file cone conflicts. DO NOT USE FOR: traditional .csproj solution scaffolding (use dotnet-solution-setup); C# language idioms unrelated to the SDK/CLI (use csharp-best-practices); benchmarking (use dotnet-benchmarking).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.1 KB |
| references/directives-reference.md | markdown | 2.1 KB |
| references/runtime-behavior.md | markdown | 4.4 KB |
references/directives-reference.md
View on GitHub# Directives Reference
`#:` directives configure the virtual project the SDK generates. Place them at the top of the file, before any code.
## `#:sdk`
Chooses the target SDK. Default: `Microsoft.NET.Sdk`.
```csharp
#:sdk Microsoft.NET.Sdk.Web
#:sdk Aspire.AppHost.Sdk@13.0.2
```
Version pin uses `@version` suffix, same as `#:package`.
## `#:package`
Adds a NuGet package reference.
```csharp
#:package Newtonsoft.Json
#:package Serilog@3.1.1
#:package Spectre.Console@*
```
- Omitting the version works only with central package management (`Directory.Packages.props`).
- Otherwise pin a version explicitly, or use `@*` for latest.
## `#:project`
References another project file or a directory containing one.
```csharp
#:project ../SharedLibrary/SharedLibrary.csproj
```
## `#:property`
Sets an MSBuild property.
```csharp
#:property TargetFramework=net10.0
#:property PublishAot=false
#:property OutputPath=./output
```
### Conditional property values
Supports MSBuild property functions/expressions for env-var-driven config:
```csharp
// Env var with fallback default
#:property LogLevel=$([MSBuild]::ValueOrDefault('$(LOG_LEVEL)', 'Information'))
// Conditional boolean expression
#:property EnableLogging=$([System.Convert]::ToBoolean($([MSBuild]::ValueOrDefault('$(ENABLE_LOGGING)', 'true'))))
```
Direct `$(VARIABLE_NAME)` references work too, but provide no fallback if unset. See MSBuild [property functions](/en-us/visualstudio/msbuild/property-functions) docs.
## `#:include`
Available in .NET 11 Preview 3 and .NET SDK 10.0.300+. Adds extra files to the compilation/package.
```csharp
#:include helpers.cs
#:include models/customer.cs
#:include shared/**/*.cs
#:include $(MSBuildProjectName).*.cs
```
Item-type mapping by extension:
| Extension | Item type |
|-----------|-----------|
| `*.cs` | `Compile` |
| `*.resx` | `EmbeddedResource` |
| `*.json` | `None` |
| `*.razor` | `Content` |
- Included `.cs` files can add types/methods/namespaces but **cannot** add top-level statements (only the entry file can).
- Supports literal paths, glob patterns, and MSBuild properties.
- Glob patterns **disable build caching** for that app.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |