[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-dotnet-csharp-scripts":3,"mdc--f5n9av-key":34,"related-repo-dotnet-csharp-scripts":2291,"related-org-dotnet-csharp-scripts":2400},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":22,"repoUrl":23,"updatedAt":24,"license":25,"forks":26,"topics":27,"repo":29,"sourceUrl":32,"mdContent":33},"csharp-scripts","run C# scripts with .NET CLI","Run file-based C# apps with the .NET CLI when the user explicitly wants C#\u002F.NET code without creating a project. Use for C# language\u002FAPI experiments, one-file C# apps, small multi-file C# apps composed with `#:include`\u002F`#:exclude`, or C# file-based apps linked with `#:ref`. Do not use for language-agnostic throwaway scripts, generic computations, Python\u002FPowerShell-style automation, full projects, or existing app integration.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"dotnet",".NET (Microsoft)","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fdotnet.png",[12,16,19],{"name":13,"slug":14,"type":15},"C#","csharp","tag",{"name":17,"slug":18,"type":15},".NET","net",{"name":20,"slug":21,"type":15},"CLI","cli",4576,"https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills","2026-07-15T06:03:36.840291","MIT",332,[28],"agent-skills",{"repoUrl":23,"stars":22,"forks":26,"topics":30,"description":31},[28],"Repository for skills to assist AI coding agents with .NET and C#","https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills\u002Ftree\u002FHEAD\u002Fplugins\u002Fdotnet-advanced\u002Fskills\u002Fcsharp-scripts","---\nname: csharp-scripts\ndescription: \"Run file-based C# apps with the .NET CLI when the user explicitly wants C#\u002F.NET code without creating a project. Use for C# language\u002FAPI experiments, one-file C# apps, small multi-file C# apps composed with `#:include`\u002F`#:exclude`, or C# file-based apps linked with `#:ref`. Do not use for language-agnostic throwaway scripts, generic computations, Python\u002FPowerShell-style automation, full projects, or existing app integration.\"\nlicense: MIT\n---\n\n# File-Based C# Apps\n\n## When to Use\n\n- Testing a C# concept, API, or language feature with a quick file-based app\n- Prototyping logic before integrating it into a larger project\n- Building a small utility from one entry-point file and a few helper `.cs` files\n\n## When Not to Use\n\n- The user asks for a language-agnostic quick script, throwaway computation, or shell\u002FPython\u002FPowerShell-style automation\n- The user needs a full project, solution integration, or project references in an existing app\n- The user is working inside an existing .NET solution and wants to add code there\n- The app is large enough that project structure, build customization, tests, or publish configuration should live in a `.csproj`\n\n## Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| C# code or intent | Yes | The code to run, or a description of what the file-based app should do |\n\n## Workflow\n\n### Step 1: Check the .NET SDK version\n\nRun `dotnet --version` to verify the SDK is installed and note the full version, including the feature band. File-based apps require .NET 10 or later. `#:include`, `#:exclude`, and transitive directive processing require SDK 10.0.300 or later; SDK 10.0.100\u002F10.0.200 builds can run single-file apps but do not support those multi-file directives. If the version is below 10, follow the [fallback for older SDKs](#fallback-for-net-9-and-earlier) instead.\n\n### Step 2: Write the app file\n\nCreate an entry-point `.cs` file using top-level statements. Place it outside any existing project directory to avoid conflicts with `.csproj` files.\n\n```csharp\n#!\u002Fusr\u002Fbin\u002Fenv dotnet\n\u002F\u002F hello.cs\nConsole.WriteLine(\"Hello from a file-based app!\");\n\nvar numbers = new[] { 1, 2, 3, 4, 5 };\nConsole.WriteLine($\"Sum: {numbers.Sum()}\");\n```\n\nGuidelines:\n\n- Use top-level statements (no `Main` method, class, or namespace boilerplate)\n- Place `using` directives at the top of the file (after the `#!` line and any `#:` directives if present)\n- Place type declarations (classes, records, enums) after all top-level statements\n\n### Step 3: Run the app\n\n```bash\ndotnet hello.cs\n```\n\nBuilds and runs the file automatically. Cached so subsequent runs are fast. Pass arguments after `--`:\n\n```bash\ndotnet hello.cs -- arg1 arg2 \"multi word arg\"\n```\n\n### Step 4: Add directives (if needed)\n\nPlace directives at the top of the file (immediately after an optional shebang line), before any `using` directives or other C# code. All directives start with `#:`.\n\n#### `#:package` — NuGet package references\n\nSpecify a version unless the app intentionally uses central package management. Use `@*` when the latest available package is acceptable (or `@*-*` for pre-release):\n\n```csharp\n#:package Humanizer@2.14.1\n\nusing Humanizer;\n\nConsole.WriteLine(\"hello world\".Titleize());\n```\n\n#### `#:property` — MSBuild properties\n\nSet any MSBuild property inline. Syntax: `#:property PropertyName=Value`\n\n```csharp\n#:property AllowUnsafeBlocks=true\n#:property PublishAot=false\n#:property NoWarn=CS0162\n```\n\nMSBuild expressions and property functions are supported:\n\n```csharp\n#:property LogLevel=$([MSBuild]::ValueOrDefault('$(LOG_LEVEL)', 'Information'))\n```\n\nCommon properties:\n\n| Property | Purpose |\n|----------|---------|\n| `AllowUnsafeBlocks=true` | Enable `unsafe` code |\n| `PublishAot=false` | Disable native AOT (enabled by default) |\n| `NoWarn=CS0162;CS0219` | Suppress specific warnings |\n| `LangVersion=preview` | Enable preview language features |\n| `InvariantGlobalization=false` | Enable culture-specific globalization |\n\n#### `#:project` — Project references\n\nReference another project by relative path:\n\n```csharp\n#:project ..\u002FMyLibrary\u002FMyLibrary.csproj\n```\n\n#### `#:ref` — File-based app references\n\nReference another `.cs` file as a separate file-based app project when it should compile into a separate assembly instead of being included in the same compilation. Use `#:include` for ordinary helper files that should share the same assembly as the entry point; use `#:ref` when you want project-reference-like boundaries.\n\n```csharp\n#:property ExperimentalFileBasedProgramEnableRefDirective=true\n#:ref ..\u002FShared\u002FFormatter.cs\n\nConsole.WriteLine(Formatter.Title(\"hello world\"));\n```\n\nGuidelines:\n\n- The referenced file is compiled as its own virtual project and added as a project reference.\n- If the referenced file is a library without top-level statements, put `#:property OutputType=Library` in that referenced file.\n- Members that must be consumed by the referencing app should be public; internal members are not visible across the assembly boundary.\n- `#:ref` is transitive: a referenced file can contain its own `#:ref` and other `#:` directives.\n- Relative paths are resolved relative to the file containing the directive.\n- Some SDK builds require `#:property ExperimentalFileBasedProgramEnableRefDirective=true`; remove that property if the SDK accepts `#:ref` without it.\n\n#### `#:sdk` — SDK selection\n\nOverride the default SDK (`Microsoft.NET.Sdk`):\n\n```csharp\n#:sdk Microsoft.NET.Sdk.Web\n```\n\n#### `#:include` and `#:exclude` — Multi-file apps\n\nIn .NET SDK 10.0.300 and later, file-based apps can include additional files in the same virtual project. Check the full `dotnet --version` output before using these directives; a 10.0.100 or 10.0.200 SDK is still .NET 10 but does not support them. Use `#:include` for helper source files and supported assets, and `#:exclude` to remove files from an include pattern or default item set.\n\n```csharp\n#!\u002Fusr\u002Fbin\u002Fenv dotnet\n#:include Helpers.cs\n#:include Models\u002F*.cs\n#:exclude Models\u002FGenerated\u002F*.cs\n\nConsole.WriteLine(Formatter.Title(\"hello world\"));\n```\n\nGuidelines:\n\n- Treat the file passed to `dotnet` as the entry point; put top-level statements there.\n- Put declarations such as classes, records, and enums in included `.cs` files.\n- Prefer explicit globs such as `Helpers.cs` or `Models\u002F*.cs` over broad recursive globs.\n- Paths are resolved relative to the file containing the directive.\n- Include directives from non-entry-point C# files are processed too, so a helper file can declare its own `#:package`, `#:property`, `#:sdk`, `#:project`, `#:ref`, `#:include`, or `#:exclude` directives.\n- Avoid duplicate directives across included files unless the directive kind explicitly supports duplicates; duplicate `#:package`, `#:property`, `#:sdk`, `#:include`, and `#:exclude` entries can fail.\n- When an app uses `#:include`, add a shebang (`#!\u002Fusr\u002Fbin\u002Fenv dotnet`) to the entry-point file on Unix-like systems to make the entry point clear to tools. Use `LF` line endings and no BOM for shebang files.\n\nExample layout:\n\n```text\nscratch\u002F\n    hello.cs\n    Helpers.cs\n    Models\u002F\n        Person.cs\n```\n\n```csharp\n#!\u002Fusr\u002Fbin\u002Fenv dotnet\n\u002F\u002F hello.cs\n#:include Helpers.cs\n#:include Models\u002F*.cs\n\nvar person = new Person(\"Ada\");\nConsole.WriteLine(Formatter.Title(person.Name));\n```\n\n```csharp\n\u002F\u002F Helpers.cs\nstatic class Formatter\n{\n    public static string Title(string value) => value.ToUpperInvariant();\n}\n```\n\n```csharp\n\u002F\u002F Models\u002FPerson.cs\nrecord Person(string Name);\n```\n\n### Step 5: Clean up\n\nRemove the app files when the user is done. To clear cached build artifacts:\n\n```bash\ndotnet clean hello.cs\n```\n\n## Unix shebang support\n\nOn Unix platforms, make a `.cs` file directly executable:\n\n1. Add a shebang as the first line of the file:\n\n    ```csharp\n    #!\u002Fusr\u002Fbin\u002Fenv dotnet\n    Console.WriteLine(\"I'm executable!\");\n    ```\n\n2. Set execute permissions:\n\n    ```bash\n    chmod +x hello.cs\n    ```\n\n3. Run directly:\n\n    ```bash\n    .\u002Fhello.cs\n    ```\n\nUse `LF` line endings (not `CRLF`) when adding a shebang. This directive is ignored on Windows.\n\n## Source-generated JSON\n\nFile-based apps enable native AOT by default. Reflection-based APIs like `JsonSerializer.Serialize\u003CT>(value)` fail at runtime under AOT. Use source-generated serialization instead:\n\n```csharp\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\n\nvar person = new Person(\"Alice\", 30);\nvar json = JsonSerializer.Serialize(person, AppJsonContext.Default.Person);\nConsole.WriteLine(json);\n\nvar deserialized = JsonSerializer.Deserialize(json, AppJsonContext.Default.Person);\nConsole.WriteLine($\"Name: {deserialized!.Name}, Age: {deserialized.Age}\");\n\nrecord Person(string Name, int Age);\n\n[JsonSerializable(typeof(Person))]\npartial class AppJsonContext : JsonSerializerContext;\n```\n\n## Converting to a project\n\nWhen a file-based app outgrows this workflow, convert it to a full project:\n\n```bash\ndotnet project convert hello.cs\n```\n\n## Fallback for .NET 9 and earlier\n\nIf the .NET SDK version is below 10, file-based apps are not available. Use a temporary console project instead:\n\n```bash\nmkdir -p \u002Ftmp\u002Fcsharp-file-based-app && cd \u002Ftmp\u002Fcsharp-file-based-app\ndotnet new console -o . --force\n```\n\nReplace the generated `Program.cs` with the app content and run with `dotnet run`. Add NuGet packages with `dotnet add package \u003Cname>`. Remove the directory when done.\n\n## Validation\n\n- [ ] `dotnet --version` reports 10.0 or later (or fallback path is used)\n- [ ] If the app uses `#:include`, `#:exclude`, or transitive directives from included files, `dotnet --version` reports SDK 10.0.300 or later\n- [ ] The app compiles without errors (can be checked explicitly with `dotnet build \u003Cfile>.cs`)\n- [ ] `dotnet \u003Cfile>.cs` produces the expected output\n- [ ] Multi-file apps include every required helper file and exclude unintended matches\n- [ ] App files and cached artifacts are cleaned up after the session\n\n## Common Pitfalls\n\n| Pitfall | Solution |\n|---------|----------|\n| `.cs` file is inside a directory with a `.csproj` | Move the app outside the project directory, or use `dotnet run --file file.cs` |\n| `#:package` without a version | Specify a version: `#:package PackageName@1.2.3` or `@*` for latest |\n| `#:property` with wrong syntax | Use `PropertyName=Value` with no spaces around `=` and no quotes: `#:property AllowUnsafeBlocks=true` |\n| Directives placed after C# code | All `#:` directives must appear immediately after an optional shebang line (if present) and before any `using` directives or other C# statements |\n| Helper file is not compiled | Add `#:include Helper.cs` or an appropriate glob to the entry-point file |\n| Shared file needs an assembly boundary | Use `#:ref Shared.cs` instead of `#:include Shared.cs`, and set `#:property OutputType=Library` in the referenced file if it has no entry point |\n| Broad include pulls in unrelated files | Prefer narrow include patterns and use `#:exclude` for generated, backup, or experimental files |\n| Duplicate directives in included files | Keep package, property, SDK, include, and exclude directives unique across the entry point and included C# files |\n| Reflection-based JSON serialization fails | Use source-generated JSON with `JsonSerializerContext` (see [Source-generated JSON](#source-generated-json)) |\n| Unexpected build behavior or version errors | File-based apps inherit `global.json`, `Directory.Build.props`, `Directory.Build.targets`, and `nuget.config` from parent directories. Move the app to an isolated directory if the inherited settings conflict |\n\n## More info\n\nSee https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcore\u002Fsdk\u002Ffile-based-apps for a full reference on file-based apps.\n",{"data":35,"body":36},{"name":4,"description":6,"license":25},{"type":37,"children":38},"root",[39,48,55,84,90,119,125,176,182,189,228,234,253,320,325,375,381,404,417,467,473,492,505,526,571,583,594,625,630,644,649,764,776,781,795,807,833,871,875,950,962,975,989,1007,1033,1085,1089,1254,1259,1269,1328,1375,1398,1404,1409,1432,1438,1450,1529,1549,1555,1568,1690,1696,1701,1729,1735,1740,1813,1842,1848,1952,1958,2265,2271,2285],{"type":40,"tag":41,"props":42,"children":44},"element","h1",{"id":43},"file-based-c-apps",[45],{"type":46,"value":47},"text","File-Based C# Apps",{"type":40,"tag":49,"props":50,"children":52},"h2",{"id":51},"when-to-use",[53],{"type":46,"value":54},"When to Use",{"type":40,"tag":56,"props":57,"children":58},"ul",{},[59,65,70],{"type":40,"tag":60,"props":61,"children":62},"li",{},[63],{"type":46,"value":64},"Testing a C# concept, API, or language feature with a quick file-based app",{"type":40,"tag":60,"props":66,"children":67},{},[68],{"type":46,"value":69},"Prototyping logic before integrating it into a larger project",{"type":40,"tag":60,"props":71,"children":72},{},[73,75,82],{"type":46,"value":74},"Building a small utility from one entry-point file and a few helper ",{"type":40,"tag":76,"props":77,"children":79},"code",{"className":78},[],[80],{"type":46,"value":81},".cs",{"type":46,"value":83}," files",{"type":40,"tag":49,"props":85,"children":87},{"id":86},"when-not-to-use",[88],{"type":46,"value":89},"When Not to Use",{"type":40,"tag":56,"props":91,"children":92},{},[93,98,103,108],{"type":40,"tag":60,"props":94,"children":95},{},[96],{"type":46,"value":97},"The user asks for a language-agnostic quick script, throwaway computation, or shell\u002FPython\u002FPowerShell-style automation",{"type":40,"tag":60,"props":99,"children":100},{},[101],{"type":46,"value":102},"The user needs a full project, solution integration, or project references in an existing app",{"type":40,"tag":60,"props":104,"children":105},{},[106],{"type":46,"value":107},"The user is working inside an existing .NET solution and wants to add code there",{"type":40,"tag":60,"props":109,"children":110},{},[111,113],{"type":46,"value":112},"The app is large enough that project structure, build customization, tests, or publish configuration should live in a ",{"type":40,"tag":76,"props":114,"children":116},{"className":115},[],[117],{"type":46,"value":118},".csproj",{"type":40,"tag":49,"props":120,"children":122},{"id":121},"inputs",[123],{"type":46,"value":124},"Inputs",{"type":40,"tag":126,"props":127,"children":128},"table",{},[129,153],{"type":40,"tag":130,"props":131,"children":132},"thead",{},[133],{"type":40,"tag":134,"props":135,"children":136},"tr",{},[137,143,148],{"type":40,"tag":138,"props":139,"children":140},"th",{},[141],{"type":46,"value":142},"Input",{"type":40,"tag":138,"props":144,"children":145},{},[146],{"type":46,"value":147},"Required",{"type":40,"tag":138,"props":149,"children":150},{},[151],{"type":46,"value":152},"Description",{"type":40,"tag":154,"props":155,"children":156},"tbody",{},[157],{"type":40,"tag":134,"props":158,"children":159},{},[160,166,171],{"type":40,"tag":161,"props":162,"children":163},"td",{},[164],{"type":46,"value":165},"C# code or intent",{"type":40,"tag":161,"props":167,"children":168},{},[169],{"type":46,"value":170},"Yes",{"type":40,"tag":161,"props":172,"children":173},{},[174],{"type":46,"value":175},"The code to run, or a description of what the file-based app should do",{"type":40,"tag":49,"props":177,"children":179},{"id":178},"workflow",[180],{"type":46,"value":181},"Workflow",{"type":40,"tag":183,"props":184,"children":186},"h3",{"id":185},"step-1-check-the-net-sdk-version",[187],{"type":46,"value":188},"Step 1: Check the .NET SDK version",{"type":40,"tag":190,"props":191,"children":192},"p",{},[193,195,201,203,209,211,217,219,226],{"type":46,"value":194},"Run ",{"type":40,"tag":76,"props":196,"children":198},{"className":197},[],[199],{"type":46,"value":200},"dotnet --version",{"type":46,"value":202}," to verify the SDK is installed and note the full version, including the feature band. File-based apps require .NET 10 or later. ",{"type":40,"tag":76,"props":204,"children":206},{"className":205},[],[207],{"type":46,"value":208},"#:include",{"type":46,"value":210},", ",{"type":40,"tag":76,"props":212,"children":214},{"className":213},[],[215],{"type":46,"value":216},"#:exclude",{"type":46,"value":218},", and transitive directive processing require SDK 10.0.300 or later; SDK 10.0.100\u002F10.0.200 builds can run single-file apps but do not support those multi-file directives. If the version is below 10, follow the ",{"type":40,"tag":220,"props":221,"children":223},"a",{"href":222},"#fallback-for-net-9-and-earlier",[224],{"type":46,"value":225},"fallback for older SDKs",{"type":46,"value":227}," instead.",{"type":40,"tag":183,"props":229,"children":231},{"id":230},"step-2-write-the-app-file",[232],{"type":46,"value":233},"Step 2: Write the app file",{"type":40,"tag":190,"props":235,"children":236},{},[237,239,244,246,251],{"type":46,"value":238},"Create an entry-point ",{"type":40,"tag":76,"props":240,"children":242},{"className":241},[],[243],{"type":46,"value":81},{"type":46,"value":245}," file using top-level statements. Place it outside any existing project directory to avoid conflicts with ",{"type":40,"tag":76,"props":247,"children":249},{"className":248},[],[250],{"type":46,"value":118},{"type":46,"value":252}," files.",{"type":40,"tag":254,"props":255,"children":259},"pre",{"className":256,"code":257,"language":14,"meta":258,"style":258},"language-csharp shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","#!\u002Fusr\u002Fbin\u002Fenv dotnet\n\u002F\u002F hello.cs\nConsole.WriteLine(\"Hello from a file-based app!\");\n\nvar numbers = new[] { 1, 2, 3, 4, 5 };\nConsole.WriteLine($\"Sum: {numbers.Sum()}\");\n","",[260],{"type":40,"tag":76,"props":261,"children":262},{"__ignoreMap":258},[263,274,283,292,302,311],{"type":40,"tag":264,"props":265,"children":268},"span",{"class":266,"line":267},"line",1,[269],{"type":40,"tag":264,"props":270,"children":271},{},[272],{"type":46,"value":273},"#!\u002Fusr\u002Fbin\u002Fenv dotnet\n",{"type":40,"tag":264,"props":275,"children":277},{"class":266,"line":276},2,[278],{"type":40,"tag":264,"props":279,"children":280},{},[281],{"type":46,"value":282},"\u002F\u002F hello.cs\n",{"type":40,"tag":264,"props":284,"children":286},{"class":266,"line":285},3,[287],{"type":40,"tag":264,"props":288,"children":289},{},[290],{"type":46,"value":291},"Console.WriteLine(\"Hello from a file-based app!\");\n",{"type":40,"tag":264,"props":293,"children":295},{"class":266,"line":294},4,[296],{"type":40,"tag":264,"props":297,"children":299},{"emptyLinePlaceholder":298},true,[300],{"type":46,"value":301},"\n",{"type":40,"tag":264,"props":303,"children":305},{"class":266,"line":304},5,[306],{"type":40,"tag":264,"props":307,"children":308},{},[309],{"type":46,"value":310},"var numbers = new[] { 1, 2, 3, 4, 5 };\n",{"type":40,"tag":264,"props":312,"children":314},{"class":266,"line":313},6,[315],{"type":40,"tag":264,"props":316,"children":317},{},[318],{"type":46,"value":319},"Console.WriteLine($\"Sum: {numbers.Sum()}\");\n",{"type":40,"tag":190,"props":321,"children":322},{},[323],{"type":46,"value":324},"Guidelines:",{"type":40,"tag":56,"props":326,"children":327},{},[328,341,370],{"type":40,"tag":60,"props":329,"children":330},{},[331,333,339],{"type":46,"value":332},"Use top-level statements (no ",{"type":40,"tag":76,"props":334,"children":336},{"className":335},[],[337],{"type":46,"value":338},"Main",{"type":46,"value":340}," method, class, or namespace boilerplate)",{"type":40,"tag":60,"props":342,"children":343},{},[344,346,352,354,360,362,368],{"type":46,"value":345},"Place ",{"type":40,"tag":76,"props":347,"children":349},{"className":348},[],[350],{"type":46,"value":351},"using",{"type":46,"value":353}," directives at the top of the file (after the ",{"type":40,"tag":76,"props":355,"children":357},{"className":356},[],[358],{"type":46,"value":359},"#!",{"type":46,"value":361}," line and any ",{"type":40,"tag":76,"props":363,"children":365},{"className":364},[],[366],{"type":46,"value":367},"#:",{"type":46,"value":369}," directives if present)",{"type":40,"tag":60,"props":371,"children":372},{},[373],{"type":46,"value":374},"Place type declarations (classes, records, enums) after all top-level statements",{"type":40,"tag":183,"props":376,"children":378},{"id":377},"step-3-run-the-app",[379],{"type":46,"value":380},"Step 3: Run the app",{"type":40,"tag":254,"props":382,"children":386},{"className":383,"code":384,"language":385,"meta":258,"style":258},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","dotnet hello.cs\n","bash",[387],{"type":40,"tag":76,"props":388,"children":389},{"__ignoreMap":258},[390],{"type":40,"tag":264,"props":391,"children":392},{"class":266,"line":267},[393,398],{"type":40,"tag":264,"props":394,"children":396},{"style":395},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[397],{"type":46,"value":8},{"type":40,"tag":264,"props":399,"children":401},{"style":400},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[402],{"type":46,"value":403}," hello.cs\n",{"type":40,"tag":190,"props":405,"children":406},{},[407,409,415],{"type":46,"value":408},"Builds and runs the file automatically. Cached so subsequent runs are fast. Pass arguments after ",{"type":40,"tag":76,"props":410,"children":412},{"className":411},[],[413],{"type":46,"value":414},"--",{"type":46,"value":416},":",{"type":40,"tag":254,"props":418,"children":420},{"className":383,"code":419,"language":385,"meta":258,"style":258},"dotnet hello.cs -- arg1 arg2 \"multi word arg\"\n",[421],{"type":40,"tag":76,"props":422,"children":423},{"__ignoreMap":258},[424],{"type":40,"tag":264,"props":425,"children":426},{"class":266,"line":267},[427,431,436,441,446,451,457,462],{"type":40,"tag":264,"props":428,"children":429},{"style":395},[430],{"type":46,"value":8},{"type":40,"tag":264,"props":432,"children":433},{"style":400},[434],{"type":46,"value":435}," hello.cs",{"type":40,"tag":264,"props":437,"children":438},{"style":400},[439],{"type":46,"value":440}," --",{"type":40,"tag":264,"props":442,"children":443},{"style":400},[444],{"type":46,"value":445}," arg1",{"type":40,"tag":264,"props":447,"children":448},{"style":400},[449],{"type":46,"value":450}," arg2",{"type":40,"tag":264,"props":452,"children":454},{"style":453},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[455],{"type":46,"value":456}," \"",{"type":40,"tag":264,"props":458,"children":459},{"style":400},[460],{"type":46,"value":461},"multi word arg",{"type":40,"tag":264,"props":463,"children":464},{"style":453},[465],{"type":46,"value":466},"\"\n",{"type":40,"tag":183,"props":468,"children":470},{"id":469},"step-4-add-directives-if-needed",[471],{"type":46,"value":472},"Step 4: Add directives (if needed)",{"type":40,"tag":190,"props":474,"children":475},{},[476,478,483,485,490],{"type":46,"value":477},"Place directives at the top of the file (immediately after an optional shebang line), before any ",{"type":40,"tag":76,"props":479,"children":481},{"className":480},[],[482],{"type":46,"value":351},{"type":46,"value":484}," directives or other C# code. All directives start with ",{"type":40,"tag":76,"props":486,"children":488},{"className":487},[],[489],{"type":46,"value":367},{"type":46,"value":491},".",{"type":40,"tag":493,"props":494,"children":496},"h4",{"id":495},"package-nuget-package-references",[497,503],{"type":40,"tag":76,"props":498,"children":500},{"className":499},[],[501],{"type":46,"value":502},"#:package",{"type":46,"value":504}," — NuGet package references",{"type":40,"tag":190,"props":506,"children":507},{},[508,510,516,518,524],{"type":46,"value":509},"Specify a version unless the app intentionally uses central package management. Use ",{"type":40,"tag":76,"props":511,"children":513},{"className":512},[],[514],{"type":46,"value":515},"@*",{"type":46,"value":517}," when the latest available package is acceptable (or ",{"type":40,"tag":76,"props":519,"children":521},{"className":520},[],[522],{"type":46,"value":523},"@*-*",{"type":46,"value":525}," for pre-release):",{"type":40,"tag":254,"props":527,"children":529},{"className":256,"code":528,"language":14,"meta":258,"style":258},"#:package Humanizer@2.14.1\n\nusing Humanizer;\n\nConsole.WriteLine(\"hello world\".Titleize());\n",[530],{"type":40,"tag":76,"props":531,"children":532},{"__ignoreMap":258},[533,541,548,556,563],{"type":40,"tag":264,"props":534,"children":535},{"class":266,"line":267},[536],{"type":40,"tag":264,"props":537,"children":538},{},[539],{"type":46,"value":540},"#:package Humanizer@2.14.1\n",{"type":40,"tag":264,"props":542,"children":543},{"class":266,"line":276},[544],{"type":40,"tag":264,"props":545,"children":546},{"emptyLinePlaceholder":298},[547],{"type":46,"value":301},{"type":40,"tag":264,"props":549,"children":550},{"class":266,"line":285},[551],{"type":40,"tag":264,"props":552,"children":553},{},[554],{"type":46,"value":555},"using Humanizer;\n",{"type":40,"tag":264,"props":557,"children":558},{"class":266,"line":294},[559],{"type":40,"tag":264,"props":560,"children":561},{"emptyLinePlaceholder":298},[562],{"type":46,"value":301},{"type":40,"tag":264,"props":564,"children":565},{"class":266,"line":304},[566],{"type":40,"tag":264,"props":567,"children":568},{},[569],{"type":46,"value":570},"Console.WriteLine(\"hello world\".Titleize());\n",{"type":40,"tag":493,"props":572,"children":574},{"id":573},"property-msbuild-properties",[575,581],{"type":40,"tag":76,"props":576,"children":578},{"className":577},[],[579],{"type":46,"value":580},"#:property",{"type":46,"value":582}," — MSBuild properties",{"type":40,"tag":190,"props":584,"children":585},{},[586,588],{"type":46,"value":587},"Set any MSBuild property inline. Syntax: ",{"type":40,"tag":76,"props":589,"children":591},{"className":590},[],[592],{"type":46,"value":593},"#:property PropertyName=Value",{"type":40,"tag":254,"props":595,"children":597},{"className":256,"code":596,"language":14,"meta":258,"style":258},"#:property AllowUnsafeBlocks=true\n#:property PublishAot=false\n#:property NoWarn=CS0162\n",[598],{"type":40,"tag":76,"props":599,"children":600},{"__ignoreMap":258},[601,609,617],{"type":40,"tag":264,"props":602,"children":603},{"class":266,"line":267},[604],{"type":40,"tag":264,"props":605,"children":606},{},[607],{"type":46,"value":608},"#:property AllowUnsafeBlocks=true\n",{"type":40,"tag":264,"props":610,"children":611},{"class":266,"line":276},[612],{"type":40,"tag":264,"props":613,"children":614},{},[615],{"type":46,"value":616},"#:property PublishAot=false\n",{"type":40,"tag":264,"props":618,"children":619},{"class":266,"line":285},[620],{"type":40,"tag":264,"props":621,"children":622},{},[623],{"type":46,"value":624},"#:property NoWarn=CS0162\n",{"type":40,"tag":190,"props":626,"children":627},{},[628],{"type":46,"value":629},"MSBuild expressions and property functions are supported:",{"type":40,"tag":254,"props":631,"children":633},{"className":256,"code":632,"language":14,"meta":258,"style":258},"#:property LogLevel=$([MSBuild]::ValueOrDefault('$(LOG_LEVEL)', 'Information'))\n",[634],{"type":40,"tag":76,"props":635,"children":636},{"__ignoreMap":258},[637],{"type":40,"tag":264,"props":638,"children":639},{"class":266,"line":267},[640],{"type":40,"tag":264,"props":641,"children":642},{},[643],{"type":46,"value":632},{"type":40,"tag":190,"props":645,"children":646},{},[647],{"type":46,"value":648},"Common properties:",{"type":40,"tag":126,"props":650,"children":651},{},[652,668],{"type":40,"tag":130,"props":653,"children":654},{},[655],{"type":40,"tag":134,"props":656,"children":657},{},[658,663],{"type":40,"tag":138,"props":659,"children":660},{},[661],{"type":46,"value":662},"Property",{"type":40,"tag":138,"props":664,"children":665},{},[666],{"type":46,"value":667},"Purpose",{"type":40,"tag":154,"props":669,"children":670},{},[671,696,713,730,747],{"type":40,"tag":134,"props":672,"children":673},{},[674,683],{"type":40,"tag":161,"props":675,"children":676},{},[677],{"type":40,"tag":76,"props":678,"children":680},{"className":679},[],[681],{"type":46,"value":682},"AllowUnsafeBlocks=true",{"type":40,"tag":161,"props":684,"children":685},{},[686,688,694],{"type":46,"value":687},"Enable ",{"type":40,"tag":76,"props":689,"children":691},{"className":690},[],[692],{"type":46,"value":693},"unsafe",{"type":46,"value":695}," code",{"type":40,"tag":134,"props":697,"children":698},{},[699,708],{"type":40,"tag":161,"props":700,"children":701},{},[702],{"type":40,"tag":76,"props":703,"children":705},{"className":704},[],[706],{"type":46,"value":707},"PublishAot=false",{"type":40,"tag":161,"props":709,"children":710},{},[711],{"type":46,"value":712},"Disable native AOT (enabled by default)",{"type":40,"tag":134,"props":714,"children":715},{},[716,725],{"type":40,"tag":161,"props":717,"children":718},{},[719],{"type":40,"tag":76,"props":720,"children":722},{"className":721},[],[723],{"type":46,"value":724},"NoWarn=CS0162;CS0219",{"type":40,"tag":161,"props":726,"children":727},{},[728],{"type":46,"value":729},"Suppress specific warnings",{"type":40,"tag":134,"props":731,"children":732},{},[733,742],{"type":40,"tag":161,"props":734,"children":735},{},[736],{"type":40,"tag":76,"props":737,"children":739},{"className":738},[],[740],{"type":46,"value":741},"LangVersion=preview",{"type":40,"tag":161,"props":743,"children":744},{},[745],{"type":46,"value":746},"Enable preview language features",{"type":40,"tag":134,"props":748,"children":749},{},[750,759],{"type":40,"tag":161,"props":751,"children":752},{},[753],{"type":40,"tag":76,"props":754,"children":756},{"className":755},[],[757],{"type":46,"value":758},"InvariantGlobalization=false",{"type":40,"tag":161,"props":760,"children":761},{},[762],{"type":46,"value":763},"Enable culture-specific globalization",{"type":40,"tag":493,"props":765,"children":767},{"id":766},"project-project-references",[768,774],{"type":40,"tag":76,"props":769,"children":771},{"className":770},[],[772],{"type":46,"value":773},"#:project",{"type":46,"value":775}," — Project references",{"type":40,"tag":190,"props":777,"children":778},{},[779],{"type":46,"value":780},"Reference another project by relative path:",{"type":40,"tag":254,"props":782,"children":784},{"className":256,"code":783,"language":14,"meta":258,"style":258},"#:project ..\u002FMyLibrary\u002FMyLibrary.csproj\n",[785],{"type":40,"tag":76,"props":786,"children":787},{"__ignoreMap":258},[788],{"type":40,"tag":264,"props":789,"children":790},{"class":266,"line":267},[791],{"type":40,"tag":264,"props":792,"children":793},{},[794],{"type":46,"value":783},{"type":40,"tag":493,"props":796,"children":798},{"id":797},"ref-file-based-app-references",[799,805],{"type":40,"tag":76,"props":800,"children":802},{"className":801},[],[803],{"type":46,"value":804},"#:ref",{"type":46,"value":806}," — File-based app references",{"type":40,"tag":190,"props":808,"children":809},{},[810,812,817,819,824,826,831],{"type":46,"value":811},"Reference another ",{"type":40,"tag":76,"props":813,"children":815},{"className":814},[],[816],{"type":46,"value":81},{"type":46,"value":818}," file as a separate file-based app project when it should compile into a separate assembly instead of being included in the same compilation. Use ",{"type":40,"tag":76,"props":820,"children":822},{"className":821},[],[823],{"type":46,"value":208},{"type":46,"value":825}," for ordinary helper files that should share the same assembly as the entry point; use ",{"type":40,"tag":76,"props":827,"children":829},{"className":828},[],[830],{"type":46,"value":804},{"type":46,"value":832}," when you want project-reference-like boundaries.",{"type":40,"tag":254,"props":834,"children":836},{"className":256,"code":835,"language":14,"meta":258,"style":258},"#:property ExperimentalFileBasedProgramEnableRefDirective=true\n#:ref ..\u002FShared\u002FFormatter.cs\n\nConsole.WriteLine(Formatter.Title(\"hello world\"));\n",[837],{"type":40,"tag":76,"props":838,"children":839},{"__ignoreMap":258},[840,848,856,863],{"type":40,"tag":264,"props":841,"children":842},{"class":266,"line":267},[843],{"type":40,"tag":264,"props":844,"children":845},{},[846],{"type":46,"value":847},"#:property ExperimentalFileBasedProgramEnableRefDirective=true\n",{"type":40,"tag":264,"props":849,"children":850},{"class":266,"line":276},[851],{"type":40,"tag":264,"props":852,"children":853},{},[854],{"type":46,"value":855},"#:ref ..\u002FShared\u002FFormatter.cs\n",{"type":40,"tag":264,"props":857,"children":858},{"class":266,"line":285},[859],{"type":40,"tag":264,"props":860,"children":861},{"emptyLinePlaceholder":298},[862],{"type":46,"value":301},{"type":40,"tag":264,"props":864,"children":865},{"class":266,"line":294},[866],{"type":40,"tag":264,"props":867,"children":868},{},[869],{"type":46,"value":870},"Console.WriteLine(Formatter.Title(\"hello world\"));\n",{"type":40,"tag":190,"props":872,"children":873},{},[874],{"type":46,"value":324},{"type":40,"tag":56,"props":876,"children":877},{},[878,883,896,901,925,930],{"type":40,"tag":60,"props":879,"children":880},{},[881],{"type":46,"value":882},"The referenced file is compiled as its own virtual project and added as a project reference.",{"type":40,"tag":60,"props":884,"children":885},{},[886,888,894],{"type":46,"value":887},"If the referenced file is a library without top-level statements, put ",{"type":40,"tag":76,"props":889,"children":891},{"className":890},[],[892],{"type":46,"value":893},"#:property OutputType=Library",{"type":46,"value":895}," in that referenced file.",{"type":40,"tag":60,"props":897,"children":898},{},[899],{"type":46,"value":900},"Members that must be consumed by the referencing app should be public; internal members are not visible across the assembly boundary.",{"type":40,"tag":60,"props":902,"children":903},{},[904,909,911,916,918,923],{"type":40,"tag":76,"props":905,"children":907},{"className":906},[],[908],{"type":46,"value":804},{"type":46,"value":910}," is transitive: a referenced file can contain its own ",{"type":40,"tag":76,"props":912,"children":914},{"className":913},[],[915],{"type":46,"value":804},{"type":46,"value":917}," and other ",{"type":40,"tag":76,"props":919,"children":921},{"className":920},[],[922],{"type":46,"value":367},{"type":46,"value":924}," directives.",{"type":40,"tag":60,"props":926,"children":927},{},[928],{"type":46,"value":929},"Relative paths are resolved relative to the file containing the directive.",{"type":40,"tag":60,"props":931,"children":932},{},[933,935,941,943,948],{"type":46,"value":934},"Some SDK builds require ",{"type":40,"tag":76,"props":936,"children":938},{"className":937},[],[939],{"type":46,"value":940},"#:property ExperimentalFileBasedProgramEnableRefDirective=true",{"type":46,"value":942},"; remove that property if the SDK accepts ",{"type":40,"tag":76,"props":944,"children":946},{"className":945},[],[947],{"type":46,"value":804},{"type":46,"value":949}," without it.",{"type":40,"tag":493,"props":951,"children":953},{"id":952},"sdk-sdk-selection",[954,960],{"type":40,"tag":76,"props":955,"children":957},{"className":956},[],[958],{"type":46,"value":959},"#:sdk",{"type":46,"value":961}," — SDK selection",{"type":40,"tag":190,"props":963,"children":964},{},[965,967,973],{"type":46,"value":966},"Override the default SDK (",{"type":40,"tag":76,"props":968,"children":970},{"className":969},[],[971],{"type":46,"value":972},"Microsoft.NET.Sdk",{"type":46,"value":974},"):",{"type":40,"tag":254,"props":976,"children":978},{"className":256,"code":977,"language":14,"meta":258,"style":258},"#:sdk Microsoft.NET.Sdk.Web\n",[979],{"type":40,"tag":76,"props":980,"children":981},{"__ignoreMap":258},[982],{"type":40,"tag":264,"props":983,"children":984},{"class":266,"line":267},[985],{"type":40,"tag":264,"props":986,"children":987},{},[988],{"type":46,"value":977},{"type":40,"tag":493,"props":990,"children":992},{"id":991},"include-and-exclude-multi-file-apps",[993,998,1000,1005],{"type":40,"tag":76,"props":994,"children":996},{"className":995},[],[997],{"type":46,"value":208},{"type":46,"value":999}," and ",{"type":40,"tag":76,"props":1001,"children":1003},{"className":1002},[],[1004],{"type":46,"value":216},{"type":46,"value":1006}," — Multi-file apps",{"type":40,"tag":190,"props":1008,"children":1009},{},[1010,1012,1017,1019,1024,1026,1031],{"type":46,"value":1011},"In .NET SDK 10.0.300 and later, file-based apps can include additional files in the same virtual project. Check the full ",{"type":40,"tag":76,"props":1013,"children":1015},{"className":1014},[],[1016],{"type":46,"value":200},{"type":46,"value":1018}," output before using these directives; a 10.0.100 or 10.0.200 SDK is still .NET 10 but does not support them. Use ",{"type":40,"tag":76,"props":1020,"children":1022},{"className":1021},[],[1023],{"type":46,"value":208},{"type":46,"value":1025}," for helper source files and supported assets, and ",{"type":40,"tag":76,"props":1027,"children":1029},{"className":1028},[],[1030],{"type":46,"value":216},{"type":46,"value":1032}," to remove files from an include pattern or default item set.",{"type":40,"tag":254,"props":1034,"children":1036},{"className":256,"code":1035,"language":14,"meta":258,"style":258},"#!\u002Fusr\u002Fbin\u002Fenv dotnet\n#:include Helpers.cs\n#:include Models\u002F*.cs\n#:exclude Models\u002FGenerated\u002F*.cs\n\nConsole.WriteLine(Formatter.Title(\"hello world\"));\n",[1037],{"type":40,"tag":76,"props":1038,"children":1039},{"__ignoreMap":258},[1040,1047,1055,1063,1071,1078],{"type":40,"tag":264,"props":1041,"children":1042},{"class":266,"line":267},[1043],{"type":40,"tag":264,"props":1044,"children":1045},{},[1046],{"type":46,"value":273},{"type":40,"tag":264,"props":1048,"children":1049},{"class":266,"line":276},[1050],{"type":40,"tag":264,"props":1051,"children":1052},{},[1053],{"type":46,"value":1054},"#:include Helpers.cs\n",{"type":40,"tag":264,"props":1056,"children":1057},{"class":266,"line":285},[1058],{"type":40,"tag":264,"props":1059,"children":1060},{},[1061],{"type":46,"value":1062},"#:include Models\u002F*.cs\n",{"type":40,"tag":264,"props":1064,"children":1065},{"class":266,"line":294},[1066],{"type":40,"tag":264,"props":1067,"children":1068},{},[1069],{"type":46,"value":1070},"#:exclude Models\u002FGenerated\u002F*.cs\n",{"type":40,"tag":264,"props":1072,"children":1073},{"class":266,"line":304},[1074],{"type":40,"tag":264,"props":1075,"children":1076},{"emptyLinePlaceholder":298},[1077],{"type":46,"value":301},{"type":40,"tag":264,"props":1079,"children":1080},{"class":266,"line":313},[1081],{"type":40,"tag":264,"props":1082,"children":1083},{},[1084],{"type":46,"value":870},{"type":40,"tag":190,"props":1086,"children":1087},{},[1088],{"type":46,"value":324},{"type":40,"tag":56,"props":1090,"children":1091},{},[1092,1104,1115,1136,1141,1189,1226],{"type":40,"tag":60,"props":1093,"children":1094},{},[1095,1097,1102],{"type":46,"value":1096},"Treat the file passed to ",{"type":40,"tag":76,"props":1098,"children":1100},{"className":1099},[],[1101],{"type":46,"value":8},{"type":46,"value":1103}," as the entry point; put top-level statements there.",{"type":40,"tag":60,"props":1105,"children":1106},{},[1107,1109,1114],{"type":46,"value":1108},"Put declarations such as classes, records, and enums in included ",{"type":40,"tag":76,"props":1110,"children":1112},{"className":1111},[],[1113],{"type":46,"value":81},{"type":46,"value":252},{"type":40,"tag":60,"props":1116,"children":1117},{},[1118,1120,1126,1128,1134],{"type":46,"value":1119},"Prefer explicit globs such as ",{"type":40,"tag":76,"props":1121,"children":1123},{"className":1122},[],[1124],{"type":46,"value":1125},"Helpers.cs",{"type":46,"value":1127}," or ",{"type":40,"tag":76,"props":1129,"children":1131},{"className":1130},[],[1132],{"type":46,"value":1133},"Models\u002F*.cs",{"type":46,"value":1135}," over broad recursive globs.",{"type":40,"tag":60,"props":1137,"children":1138},{},[1139],{"type":46,"value":1140},"Paths are resolved relative to the file containing the directive.",{"type":40,"tag":60,"props":1142,"children":1143},{},[1144,1146,1151,1152,1157,1158,1163,1164,1169,1170,1175,1176,1181,1183,1188],{"type":46,"value":1145},"Include directives from non-entry-point C# files are processed too, so a helper file can declare its own ",{"type":40,"tag":76,"props":1147,"children":1149},{"className":1148},[],[1150],{"type":46,"value":502},{"type":46,"value":210},{"type":40,"tag":76,"props":1153,"children":1155},{"className":1154},[],[1156],{"type":46,"value":580},{"type":46,"value":210},{"type":40,"tag":76,"props":1159,"children":1161},{"className":1160},[],[1162],{"type":46,"value":959},{"type":46,"value":210},{"type":40,"tag":76,"props":1165,"children":1167},{"className":1166},[],[1168],{"type":46,"value":773},{"type":46,"value":210},{"type":40,"tag":76,"props":1171,"children":1173},{"className":1172},[],[1174],{"type":46,"value":804},{"type":46,"value":210},{"type":40,"tag":76,"props":1177,"children":1179},{"className":1178},[],[1180],{"type":46,"value":208},{"type":46,"value":1182},", or ",{"type":40,"tag":76,"props":1184,"children":1186},{"className":1185},[],[1187],{"type":46,"value":216},{"type":46,"value":924},{"type":40,"tag":60,"props":1190,"children":1191},{},[1192,1194,1199,1200,1205,1206,1211,1212,1217,1219,1224],{"type":46,"value":1193},"Avoid duplicate directives across included files unless the directive kind explicitly supports duplicates; duplicate ",{"type":40,"tag":76,"props":1195,"children":1197},{"className":1196},[],[1198],{"type":46,"value":502},{"type":46,"value":210},{"type":40,"tag":76,"props":1201,"children":1203},{"className":1202},[],[1204],{"type":46,"value":580},{"type":46,"value":210},{"type":40,"tag":76,"props":1207,"children":1209},{"className":1208},[],[1210],{"type":46,"value":959},{"type":46,"value":210},{"type":40,"tag":76,"props":1213,"children":1215},{"className":1214},[],[1216],{"type":46,"value":208},{"type":46,"value":1218},", and ",{"type":40,"tag":76,"props":1220,"children":1222},{"className":1221},[],[1223],{"type":46,"value":216},{"type":46,"value":1225}," entries can fail.",{"type":40,"tag":60,"props":1227,"children":1228},{},[1229,1231,1236,1238,1244,1246,1252],{"type":46,"value":1230},"When an app uses ",{"type":40,"tag":76,"props":1232,"children":1234},{"className":1233},[],[1235],{"type":46,"value":208},{"type":46,"value":1237},", add a shebang (",{"type":40,"tag":76,"props":1239,"children":1241},{"className":1240},[],[1242],{"type":46,"value":1243},"#!\u002Fusr\u002Fbin\u002Fenv dotnet",{"type":46,"value":1245},") to the entry-point file on Unix-like systems to make the entry point clear to tools. Use ",{"type":40,"tag":76,"props":1247,"children":1249},{"className":1248},[],[1250],{"type":46,"value":1251},"LF",{"type":46,"value":1253}," line endings and no BOM for shebang files.",{"type":40,"tag":190,"props":1255,"children":1256},{},[1257],{"type":46,"value":1258},"Example layout:",{"type":40,"tag":254,"props":1260,"children":1264},{"className":1261,"code":1263,"language":46,"meta":258},[1262],"language-text","scratch\u002F\n    hello.cs\n    Helpers.cs\n    Models\u002F\n        Person.cs\n",[1265],{"type":40,"tag":76,"props":1266,"children":1267},{"__ignoreMap":258},[1268],{"type":46,"value":1263},{"type":40,"tag":254,"props":1270,"children":1272},{"className":256,"code":1271,"language":14,"meta":258,"style":258},"#!\u002Fusr\u002Fbin\u002Fenv dotnet\n\u002F\u002F hello.cs\n#:include Helpers.cs\n#:include Models\u002F*.cs\n\nvar person = new Person(\"Ada\");\nConsole.WriteLine(Formatter.Title(person.Name));\n",[1273],{"type":40,"tag":76,"props":1274,"children":1275},{"__ignoreMap":258},[1276,1283,1290,1297,1304,1311,1319],{"type":40,"tag":264,"props":1277,"children":1278},{"class":266,"line":267},[1279],{"type":40,"tag":264,"props":1280,"children":1281},{},[1282],{"type":46,"value":273},{"type":40,"tag":264,"props":1284,"children":1285},{"class":266,"line":276},[1286],{"type":40,"tag":264,"props":1287,"children":1288},{},[1289],{"type":46,"value":282},{"type":40,"tag":264,"props":1291,"children":1292},{"class":266,"line":285},[1293],{"type":40,"tag":264,"props":1294,"children":1295},{},[1296],{"type":46,"value":1054},{"type":40,"tag":264,"props":1298,"children":1299},{"class":266,"line":294},[1300],{"type":40,"tag":264,"props":1301,"children":1302},{},[1303],{"type":46,"value":1062},{"type":40,"tag":264,"props":1305,"children":1306},{"class":266,"line":304},[1307],{"type":40,"tag":264,"props":1308,"children":1309},{"emptyLinePlaceholder":298},[1310],{"type":46,"value":301},{"type":40,"tag":264,"props":1312,"children":1313},{"class":266,"line":313},[1314],{"type":40,"tag":264,"props":1315,"children":1316},{},[1317],{"type":46,"value":1318},"var person = new Person(\"Ada\");\n",{"type":40,"tag":264,"props":1320,"children":1322},{"class":266,"line":1321},7,[1323],{"type":40,"tag":264,"props":1324,"children":1325},{},[1326],{"type":46,"value":1327},"Console.WriteLine(Formatter.Title(person.Name));\n",{"type":40,"tag":254,"props":1329,"children":1331},{"className":256,"code":1330,"language":14,"meta":258,"style":258},"\u002F\u002F Helpers.cs\nstatic class Formatter\n{\n    public static string Title(string value) => value.ToUpperInvariant();\n}\n",[1332],{"type":40,"tag":76,"props":1333,"children":1334},{"__ignoreMap":258},[1335,1343,1351,1359,1367],{"type":40,"tag":264,"props":1336,"children":1337},{"class":266,"line":267},[1338],{"type":40,"tag":264,"props":1339,"children":1340},{},[1341],{"type":46,"value":1342},"\u002F\u002F Helpers.cs\n",{"type":40,"tag":264,"props":1344,"children":1345},{"class":266,"line":276},[1346],{"type":40,"tag":264,"props":1347,"children":1348},{},[1349],{"type":46,"value":1350},"static class Formatter\n",{"type":40,"tag":264,"props":1352,"children":1353},{"class":266,"line":285},[1354],{"type":40,"tag":264,"props":1355,"children":1356},{},[1357],{"type":46,"value":1358},"{\n",{"type":40,"tag":264,"props":1360,"children":1361},{"class":266,"line":294},[1362],{"type":40,"tag":264,"props":1363,"children":1364},{},[1365],{"type":46,"value":1366},"    public static string Title(string value) => value.ToUpperInvariant();\n",{"type":40,"tag":264,"props":1368,"children":1369},{"class":266,"line":304},[1370],{"type":40,"tag":264,"props":1371,"children":1372},{},[1373],{"type":46,"value":1374},"}\n",{"type":40,"tag":254,"props":1376,"children":1378},{"className":256,"code":1377,"language":14,"meta":258,"style":258},"\u002F\u002F Models\u002FPerson.cs\nrecord Person(string Name);\n",[1379],{"type":40,"tag":76,"props":1380,"children":1381},{"__ignoreMap":258},[1382,1390],{"type":40,"tag":264,"props":1383,"children":1384},{"class":266,"line":267},[1385],{"type":40,"tag":264,"props":1386,"children":1387},{},[1388],{"type":46,"value":1389},"\u002F\u002F Models\u002FPerson.cs\n",{"type":40,"tag":264,"props":1391,"children":1392},{"class":266,"line":276},[1393],{"type":40,"tag":264,"props":1394,"children":1395},{},[1396],{"type":46,"value":1397},"record Person(string Name);\n",{"type":40,"tag":183,"props":1399,"children":1401},{"id":1400},"step-5-clean-up",[1402],{"type":46,"value":1403},"Step 5: Clean up",{"type":40,"tag":190,"props":1405,"children":1406},{},[1407],{"type":46,"value":1408},"Remove the app files when the user is done. To clear cached build artifacts:",{"type":40,"tag":254,"props":1410,"children":1412},{"className":383,"code":1411,"language":385,"meta":258,"style":258},"dotnet clean hello.cs\n",[1413],{"type":40,"tag":76,"props":1414,"children":1415},{"__ignoreMap":258},[1416],{"type":40,"tag":264,"props":1417,"children":1418},{"class":266,"line":267},[1419,1423,1428],{"type":40,"tag":264,"props":1420,"children":1421},{"style":395},[1422],{"type":46,"value":8},{"type":40,"tag":264,"props":1424,"children":1425},{"style":400},[1426],{"type":46,"value":1427}," clean",{"type":40,"tag":264,"props":1429,"children":1430},{"style":400},[1431],{"type":46,"value":403},{"type":40,"tag":49,"props":1433,"children":1435},{"id":1434},"unix-shebang-support",[1436],{"type":46,"value":1437},"Unix shebang support",{"type":40,"tag":190,"props":1439,"children":1440},{},[1441,1443,1448],{"type":46,"value":1442},"On Unix platforms, make a ",{"type":40,"tag":76,"props":1444,"children":1446},{"className":1445},[],[1447],{"type":46,"value":81},{"type":46,"value":1449}," file directly executable:",{"type":40,"tag":1451,"props":1452,"children":1453},"ol",{},[1454,1481,1510],{"type":40,"tag":60,"props":1455,"children":1456},{},[1457,1459],{"type":46,"value":1458},"Add a shebang as the first line of the file:",{"type":40,"tag":254,"props":1460,"children":1462},{"className":256,"code":1461,"language":14,"meta":258,"style":258},"#!\u002Fusr\u002Fbin\u002Fenv dotnet\nConsole.WriteLine(\"I'm executable!\");\n",[1463],{"type":40,"tag":76,"props":1464,"children":1465},{"__ignoreMap":258},[1466,1473],{"type":40,"tag":264,"props":1467,"children":1468},{"class":266,"line":267},[1469],{"type":40,"tag":264,"props":1470,"children":1471},{},[1472],{"type":46,"value":273},{"type":40,"tag":264,"props":1474,"children":1475},{"class":266,"line":276},[1476],{"type":40,"tag":264,"props":1477,"children":1478},{},[1479],{"type":46,"value":1480},"Console.WriteLine(\"I'm executable!\");\n",{"type":40,"tag":60,"props":1482,"children":1483},{},[1484,1486],{"type":46,"value":1485},"Set execute permissions:",{"type":40,"tag":254,"props":1487,"children":1489},{"className":383,"code":1488,"language":385,"meta":258,"style":258},"chmod +x hello.cs\n",[1490],{"type":40,"tag":76,"props":1491,"children":1492},{"__ignoreMap":258},[1493],{"type":40,"tag":264,"props":1494,"children":1495},{"class":266,"line":267},[1496,1501,1506],{"type":40,"tag":264,"props":1497,"children":1498},{"style":395},[1499],{"type":46,"value":1500},"chmod",{"type":40,"tag":264,"props":1502,"children":1503},{"style":400},[1504],{"type":46,"value":1505}," +x",{"type":40,"tag":264,"props":1507,"children":1508},{"style":400},[1509],{"type":46,"value":403},{"type":40,"tag":60,"props":1511,"children":1512},{},[1513,1515],{"type":46,"value":1514},"Run directly:",{"type":40,"tag":254,"props":1516,"children":1518},{"className":383,"code":1517,"language":385,"meta":258,"style":258},".\u002Fhello.cs\n",[1519],{"type":40,"tag":76,"props":1520,"children":1521},{"__ignoreMap":258},[1522],{"type":40,"tag":264,"props":1523,"children":1524},{"class":266,"line":267},[1525],{"type":40,"tag":264,"props":1526,"children":1527},{"style":395},[1528],{"type":46,"value":1517},{"type":40,"tag":190,"props":1530,"children":1531},{},[1532,1534,1539,1541,1547],{"type":46,"value":1533},"Use ",{"type":40,"tag":76,"props":1535,"children":1537},{"className":1536},[],[1538],{"type":46,"value":1251},{"type":46,"value":1540}," line endings (not ",{"type":40,"tag":76,"props":1542,"children":1544},{"className":1543},[],[1545],{"type":46,"value":1546},"CRLF",{"type":46,"value":1548},") when adding a shebang. This directive is ignored on Windows.",{"type":40,"tag":49,"props":1550,"children":1552},{"id":1551},"source-generated-json",[1553],{"type":46,"value":1554},"Source-generated JSON",{"type":40,"tag":190,"props":1556,"children":1557},{},[1558,1560,1566],{"type":46,"value":1559},"File-based apps enable native AOT by default. Reflection-based APIs like ",{"type":40,"tag":76,"props":1561,"children":1563},{"className":1562},[],[1564],{"type":46,"value":1565},"JsonSerializer.Serialize\u003CT>(value)",{"type":46,"value":1567}," fail at runtime under AOT. Use source-generated serialization instead:",{"type":40,"tag":254,"props":1569,"children":1571},{"className":256,"code":1570,"language":14,"meta":258,"style":258},"using System.Text.Json;\nusing System.Text.Json.Serialization;\n\nvar person = new Person(\"Alice\", 30);\nvar json = JsonSerializer.Serialize(person, AppJsonContext.Default.Person);\nConsole.WriteLine(json);\n\nvar deserialized = JsonSerializer.Deserialize(json, AppJsonContext.Default.Person);\nConsole.WriteLine($\"Name: {deserialized!.Name}, Age: {deserialized.Age}\");\n\nrecord Person(string Name, int Age);\n\n[JsonSerializable(typeof(Person))]\npartial class AppJsonContext : JsonSerializerContext;\n",[1572],{"type":40,"tag":76,"props":1573,"children":1574},{"__ignoreMap":258},[1575,1583,1591,1598,1606,1614,1622,1629,1638,1647,1655,1664,1672,1681],{"type":40,"tag":264,"props":1576,"children":1577},{"class":266,"line":267},[1578],{"type":40,"tag":264,"props":1579,"children":1580},{},[1581],{"type":46,"value":1582},"using System.Text.Json;\n",{"type":40,"tag":264,"props":1584,"children":1585},{"class":266,"line":276},[1586],{"type":40,"tag":264,"props":1587,"children":1588},{},[1589],{"type":46,"value":1590},"using System.Text.Json.Serialization;\n",{"type":40,"tag":264,"props":1592,"children":1593},{"class":266,"line":285},[1594],{"type":40,"tag":264,"props":1595,"children":1596},{"emptyLinePlaceholder":298},[1597],{"type":46,"value":301},{"type":40,"tag":264,"props":1599,"children":1600},{"class":266,"line":294},[1601],{"type":40,"tag":264,"props":1602,"children":1603},{},[1604],{"type":46,"value":1605},"var person = new Person(\"Alice\", 30);\n",{"type":40,"tag":264,"props":1607,"children":1608},{"class":266,"line":304},[1609],{"type":40,"tag":264,"props":1610,"children":1611},{},[1612],{"type":46,"value":1613},"var json = JsonSerializer.Serialize(person, AppJsonContext.Default.Person);\n",{"type":40,"tag":264,"props":1615,"children":1616},{"class":266,"line":313},[1617],{"type":40,"tag":264,"props":1618,"children":1619},{},[1620],{"type":46,"value":1621},"Console.WriteLine(json);\n",{"type":40,"tag":264,"props":1623,"children":1624},{"class":266,"line":1321},[1625],{"type":40,"tag":264,"props":1626,"children":1627},{"emptyLinePlaceholder":298},[1628],{"type":46,"value":301},{"type":40,"tag":264,"props":1630,"children":1632},{"class":266,"line":1631},8,[1633],{"type":40,"tag":264,"props":1634,"children":1635},{},[1636],{"type":46,"value":1637},"var deserialized = JsonSerializer.Deserialize(json, AppJsonContext.Default.Person);\n",{"type":40,"tag":264,"props":1639,"children":1641},{"class":266,"line":1640},9,[1642],{"type":40,"tag":264,"props":1643,"children":1644},{},[1645],{"type":46,"value":1646},"Console.WriteLine($\"Name: {deserialized!.Name}, Age: {deserialized.Age}\");\n",{"type":40,"tag":264,"props":1648,"children":1650},{"class":266,"line":1649},10,[1651],{"type":40,"tag":264,"props":1652,"children":1653},{"emptyLinePlaceholder":298},[1654],{"type":46,"value":301},{"type":40,"tag":264,"props":1656,"children":1658},{"class":266,"line":1657},11,[1659],{"type":40,"tag":264,"props":1660,"children":1661},{},[1662],{"type":46,"value":1663},"record Person(string Name, int Age);\n",{"type":40,"tag":264,"props":1665,"children":1667},{"class":266,"line":1666},12,[1668],{"type":40,"tag":264,"props":1669,"children":1670},{"emptyLinePlaceholder":298},[1671],{"type":46,"value":301},{"type":40,"tag":264,"props":1673,"children":1675},{"class":266,"line":1674},13,[1676],{"type":40,"tag":264,"props":1677,"children":1678},{},[1679],{"type":46,"value":1680},"[JsonSerializable(typeof(Person))]\n",{"type":40,"tag":264,"props":1682,"children":1684},{"class":266,"line":1683},14,[1685],{"type":40,"tag":264,"props":1686,"children":1687},{},[1688],{"type":46,"value":1689},"partial class AppJsonContext : JsonSerializerContext;\n",{"type":40,"tag":49,"props":1691,"children":1693},{"id":1692},"converting-to-a-project",[1694],{"type":46,"value":1695},"Converting to a project",{"type":40,"tag":190,"props":1697,"children":1698},{},[1699],{"type":46,"value":1700},"When a file-based app outgrows this workflow, convert it to a full project:",{"type":40,"tag":254,"props":1702,"children":1704},{"className":383,"code":1703,"language":385,"meta":258,"style":258},"dotnet project convert hello.cs\n",[1705],{"type":40,"tag":76,"props":1706,"children":1707},{"__ignoreMap":258},[1708],{"type":40,"tag":264,"props":1709,"children":1710},{"class":266,"line":267},[1711,1715,1720,1725],{"type":40,"tag":264,"props":1712,"children":1713},{"style":395},[1714],{"type":46,"value":8},{"type":40,"tag":264,"props":1716,"children":1717},{"style":400},[1718],{"type":46,"value":1719}," project",{"type":40,"tag":264,"props":1721,"children":1722},{"style":400},[1723],{"type":46,"value":1724}," convert",{"type":40,"tag":264,"props":1726,"children":1727},{"style":400},[1728],{"type":46,"value":403},{"type":40,"tag":49,"props":1730,"children":1732},{"id":1731},"fallback-for-net-9-and-earlier",[1733],{"type":46,"value":1734},"Fallback for .NET 9 and earlier",{"type":40,"tag":190,"props":1736,"children":1737},{},[1738],{"type":46,"value":1739},"If the .NET SDK version is below 10, file-based apps are not available. Use a temporary console project instead:",{"type":40,"tag":254,"props":1741,"children":1743},{"className":383,"code":1742,"language":385,"meta":258,"style":258},"mkdir -p \u002Ftmp\u002Fcsharp-file-based-app && cd \u002Ftmp\u002Fcsharp-file-based-app\ndotnet new console -o . --force\n",[1744],{"type":40,"tag":76,"props":1745,"children":1746},{"__ignoreMap":258},[1747,1781],{"type":40,"tag":264,"props":1748,"children":1749},{"class":266,"line":267},[1750,1755,1760,1765,1770,1776],{"type":40,"tag":264,"props":1751,"children":1752},{"style":395},[1753],{"type":46,"value":1754},"mkdir",{"type":40,"tag":264,"props":1756,"children":1757},{"style":400},[1758],{"type":46,"value":1759}," -p",{"type":40,"tag":264,"props":1761,"children":1762},{"style":400},[1763],{"type":46,"value":1764}," \u002Ftmp\u002Fcsharp-file-based-app",{"type":40,"tag":264,"props":1766,"children":1767},{"style":453},[1768],{"type":46,"value":1769}," &&",{"type":40,"tag":264,"props":1771,"children":1773},{"style":1772},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[1774],{"type":46,"value":1775}," cd",{"type":40,"tag":264,"props":1777,"children":1778},{"style":400},[1779],{"type":46,"value":1780}," \u002Ftmp\u002Fcsharp-file-based-app\n",{"type":40,"tag":264,"props":1782,"children":1783},{"class":266,"line":276},[1784,1788,1793,1798,1803,1808],{"type":40,"tag":264,"props":1785,"children":1786},{"style":395},[1787],{"type":46,"value":8},{"type":40,"tag":264,"props":1789,"children":1790},{"style":400},[1791],{"type":46,"value":1792}," new",{"type":40,"tag":264,"props":1794,"children":1795},{"style":400},[1796],{"type":46,"value":1797}," console",{"type":40,"tag":264,"props":1799,"children":1800},{"style":400},[1801],{"type":46,"value":1802}," -o",{"type":40,"tag":264,"props":1804,"children":1805},{"style":400},[1806],{"type":46,"value":1807}," .",{"type":40,"tag":264,"props":1809,"children":1810},{"style":400},[1811],{"type":46,"value":1812}," --force\n",{"type":40,"tag":190,"props":1814,"children":1815},{},[1816,1818,1824,1826,1832,1834,1840],{"type":46,"value":1817},"Replace the generated ",{"type":40,"tag":76,"props":1819,"children":1821},{"className":1820},[],[1822],{"type":46,"value":1823},"Program.cs",{"type":46,"value":1825}," with the app content and run with ",{"type":40,"tag":76,"props":1827,"children":1829},{"className":1828},[],[1830],{"type":46,"value":1831},"dotnet run",{"type":46,"value":1833},". Add NuGet packages with ",{"type":40,"tag":76,"props":1835,"children":1837},{"className":1836},[],[1838],{"type":46,"value":1839},"dotnet add package \u003Cname>",{"type":46,"value":1841},". Remove the directory when done.",{"type":40,"tag":49,"props":1843,"children":1845},{"id":1844},"validation",[1846],{"type":46,"value":1847},"Validation",{"type":40,"tag":56,"props":1849,"children":1852},{"className":1850},[1851],"contains-task-list",[1853,1872,1901,1918,1934,1943],{"type":40,"tag":60,"props":1854,"children":1857},{"className":1855},[1856],"task-list-item",[1858,1863,1865,1870],{"type":40,"tag":1859,"props":1860,"children":1862},"input",{"disabled":298,"type":1861},"checkbox",[],{"type":46,"value":1864}," ",{"type":40,"tag":76,"props":1866,"children":1868},{"className":1867},[],[1869],{"type":46,"value":200},{"type":46,"value":1871}," reports 10.0 or later (or fallback path is used)",{"type":40,"tag":60,"props":1873,"children":1875},{"className":1874},[1856],[1876,1879,1881,1886,1887,1892,1894,1899],{"type":40,"tag":1859,"props":1877,"children":1878},{"disabled":298,"type":1861},[],{"type":46,"value":1880}," If the app uses ",{"type":40,"tag":76,"props":1882,"children":1884},{"className":1883},[],[1885],{"type":46,"value":208},{"type":46,"value":210},{"type":40,"tag":76,"props":1888,"children":1890},{"className":1889},[],[1891],{"type":46,"value":216},{"type":46,"value":1893},", or transitive directives from included files, ",{"type":40,"tag":76,"props":1895,"children":1897},{"className":1896},[],[1898],{"type":46,"value":200},{"type":46,"value":1900}," reports SDK 10.0.300 or later",{"type":40,"tag":60,"props":1902,"children":1904},{"className":1903},[1856],[1905,1908,1910,1916],{"type":40,"tag":1859,"props":1906,"children":1907},{"disabled":298,"type":1861},[],{"type":46,"value":1909}," The app compiles without errors (can be checked explicitly with ",{"type":40,"tag":76,"props":1911,"children":1913},{"className":1912},[],[1914],{"type":46,"value":1915},"dotnet build \u003Cfile>.cs",{"type":46,"value":1917},")",{"type":40,"tag":60,"props":1919,"children":1921},{"className":1920},[1856],[1922,1925,1926,1932],{"type":40,"tag":1859,"props":1923,"children":1924},{"disabled":298,"type":1861},[],{"type":46,"value":1864},{"type":40,"tag":76,"props":1927,"children":1929},{"className":1928},[],[1930],{"type":46,"value":1931},"dotnet \u003Cfile>.cs",{"type":46,"value":1933}," produces the expected output",{"type":40,"tag":60,"props":1935,"children":1937},{"className":1936},[1856],[1938,1941],{"type":40,"tag":1859,"props":1939,"children":1940},{"disabled":298,"type":1861},[],{"type":46,"value":1942}," Multi-file apps include every required helper file and exclude unintended matches",{"type":40,"tag":60,"props":1944,"children":1946},{"className":1945},[1856],[1947,1950],{"type":40,"tag":1859,"props":1948,"children":1949},{"disabled":298,"type":1861},[],{"type":46,"value":1951}," App files and cached artifacts are cleaned up after the session",{"type":40,"tag":49,"props":1953,"children":1955},{"id":1954},"common-pitfalls",[1956],{"type":46,"value":1957},"Common Pitfalls",{"type":40,"tag":126,"props":1959,"children":1960},{},[1961,1977],{"type":40,"tag":130,"props":1962,"children":1963},{},[1964],{"type":40,"tag":134,"props":1965,"children":1966},{},[1967,1972],{"type":40,"tag":138,"props":1968,"children":1969},{},[1970],{"type":46,"value":1971},"Pitfall",{"type":40,"tag":138,"props":1973,"children":1974},{},[1975],{"type":46,"value":1976},"Solution",{"type":40,"tag":154,"props":1978,"children":1979},{},[1980,2009,2041,2080,2107,2128,2163,2183,2196,2223],{"type":40,"tag":134,"props":1981,"children":1982},{},[1983,1998],{"type":40,"tag":161,"props":1984,"children":1985},{},[1986,1991,1993],{"type":40,"tag":76,"props":1987,"children":1989},{"className":1988},[],[1990],{"type":46,"value":81},{"type":46,"value":1992}," file is inside a directory with a ",{"type":40,"tag":76,"props":1994,"children":1996},{"className":1995},[],[1997],{"type":46,"value":118},{"type":40,"tag":161,"props":1999,"children":2000},{},[2001,2003],{"type":46,"value":2002},"Move the app outside the project directory, or use ",{"type":40,"tag":76,"props":2004,"children":2006},{"className":2005},[],[2007],{"type":46,"value":2008},"dotnet run --file file.cs",{"type":40,"tag":134,"props":2010,"children":2011},{},[2012,2022],{"type":40,"tag":161,"props":2013,"children":2014},{},[2015,2020],{"type":40,"tag":76,"props":2016,"children":2018},{"className":2017},[],[2019],{"type":46,"value":502},{"type":46,"value":2021}," without a version",{"type":40,"tag":161,"props":2023,"children":2024},{},[2025,2027,2033,2034,2039],{"type":46,"value":2026},"Specify a version: ",{"type":40,"tag":76,"props":2028,"children":2030},{"className":2029},[],[2031],{"type":46,"value":2032},"#:package PackageName@1.2.3",{"type":46,"value":1127},{"type":40,"tag":76,"props":2035,"children":2037},{"className":2036},[],[2038],{"type":46,"value":515},{"type":46,"value":2040}," for latest",{"type":40,"tag":134,"props":2042,"children":2043},{},[2044,2054],{"type":40,"tag":161,"props":2045,"children":2046},{},[2047,2052],{"type":40,"tag":76,"props":2048,"children":2050},{"className":2049},[],[2051],{"type":46,"value":580},{"type":46,"value":2053}," with wrong syntax",{"type":40,"tag":161,"props":2055,"children":2056},{},[2057,2058,2064,2066,2072,2074],{"type":46,"value":1533},{"type":40,"tag":76,"props":2059,"children":2061},{"className":2060},[],[2062],{"type":46,"value":2063},"PropertyName=Value",{"type":46,"value":2065}," with no spaces around ",{"type":40,"tag":76,"props":2067,"children":2069},{"className":2068},[],[2070],{"type":46,"value":2071},"=",{"type":46,"value":2073}," and no quotes: ",{"type":40,"tag":76,"props":2075,"children":2077},{"className":2076},[],[2078],{"type":46,"value":2079},"#:property AllowUnsafeBlocks=true",{"type":40,"tag":134,"props":2081,"children":2082},{},[2083,2088],{"type":40,"tag":161,"props":2084,"children":2085},{},[2086],{"type":46,"value":2087},"Directives placed after C# code",{"type":40,"tag":161,"props":2089,"children":2090},{},[2091,2093,2098,2100,2105],{"type":46,"value":2092},"All ",{"type":40,"tag":76,"props":2094,"children":2096},{"className":2095},[],[2097],{"type":46,"value":367},{"type":46,"value":2099}," directives must appear immediately after an optional shebang line (if present) and before any ",{"type":40,"tag":76,"props":2101,"children":2103},{"className":2102},[],[2104],{"type":46,"value":351},{"type":46,"value":2106}," directives or other C# statements",{"type":40,"tag":134,"props":2108,"children":2109},{},[2110,2115],{"type":40,"tag":161,"props":2111,"children":2112},{},[2113],{"type":46,"value":2114},"Helper file is not compiled",{"type":40,"tag":161,"props":2116,"children":2117},{},[2118,2120,2126],{"type":46,"value":2119},"Add ",{"type":40,"tag":76,"props":2121,"children":2123},{"className":2122},[],[2124],{"type":46,"value":2125},"#:include Helper.cs",{"type":46,"value":2127}," or an appropriate glob to the entry-point file",{"type":40,"tag":134,"props":2129,"children":2130},{},[2131,2136],{"type":40,"tag":161,"props":2132,"children":2133},{},[2134],{"type":46,"value":2135},"Shared file needs an assembly boundary",{"type":40,"tag":161,"props":2137,"children":2138},{},[2139,2140,2146,2148,2154,2156,2161],{"type":46,"value":1533},{"type":40,"tag":76,"props":2141,"children":2143},{"className":2142},[],[2144],{"type":46,"value":2145},"#:ref Shared.cs",{"type":46,"value":2147}," instead of ",{"type":40,"tag":76,"props":2149,"children":2151},{"className":2150},[],[2152],{"type":46,"value":2153},"#:include Shared.cs",{"type":46,"value":2155},", and set ",{"type":40,"tag":76,"props":2157,"children":2159},{"className":2158},[],[2160],{"type":46,"value":893},{"type":46,"value":2162}," in the referenced file if it has no entry point",{"type":40,"tag":134,"props":2164,"children":2165},{},[2166,2171],{"type":40,"tag":161,"props":2167,"children":2168},{},[2169],{"type":46,"value":2170},"Broad include pulls in unrelated files",{"type":40,"tag":161,"props":2172,"children":2173},{},[2174,2176,2181],{"type":46,"value":2175},"Prefer narrow include patterns and use ",{"type":40,"tag":76,"props":2177,"children":2179},{"className":2178},[],[2180],{"type":46,"value":216},{"type":46,"value":2182}," for generated, backup, or experimental files",{"type":40,"tag":134,"props":2184,"children":2185},{},[2186,2191],{"type":40,"tag":161,"props":2187,"children":2188},{},[2189],{"type":46,"value":2190},"Duplicate directives in included files",{"type":40,"tag":161,"props":2192,"children":2193},{},[2194],{"type":46,"value":2195},"Keep package, property, SDK, include, and exclude directives unique across the entry point and included C# files",{"type":40,"tag":134,"props":2197,"children":2198},{},[2199,2204],{"type":40,"tag":161,"props":2200,"children":2201},{},[2202],{"type":46,"value":2203},"Reflection-based JSON serialization fails",{"type":40,"tag":161,"props":2205,"children":2206},{},[2207,2209,2215,2217,2222],{"type":46,"value":2208},"Use source-generated JSON with ",{"type":40,"tag":76,"props":2210,"children":2212},{"className":2211},[],[2213],{"type":46,"value":2214},"JsonSerializerContext",{"type":46,"value":2216}," (see ",{"type":40,"tag":220,"props":2218,"children":2220},{"href":2219},"#source-generated-json",[2221],{"type":46,"value":1554},{"type":46,"value":1917},{"type":40,"tag":134,"props":2224,"children":2225},{},[2226,2231],{"type":40,"tag":161,"props":2227,"children":2228},{},[2229],{"type":46,"value":2230},"Unexpected build behavior or version errors",{"type":40,"tag":161,"props":2232,"children":2233},{},[2234,2236,2242,2243,2249,2250,2256,2257,2263],{"type":46,"value":2235},"File-based apps inherit ",{"type":40,"tag":76,"props":2237,"children":2239},{"className":2238},[],[2240],{"type":46,"value":2241},"global.json",{"type":46,"value":210},{"type":40,"tag":76,"props":2244,"children":2246},{"className":2245},[],[2247],{"type":46,"value":2248},"Directory.Build.props",{"type":46,"value":210},{"type":40,"tag":76,"props":2251,"children":2253},{"className":2252},[],[2254],{"type":46,"value":2255},"Directory.Build.targets",{"type":46,"value":1218},{"type":40,"tag":76,"props":2258,"children":2260},{"className":2259},[],[2261],{"type":46,"value":2262},"nuget.config",{"type":46,"value":2264}," from parent directories. Move the app to an isolated directory if the inherited settings conflict",{"type":40,"tag":49,"props":2266,"children":2268},{"id":2267},"more-info",[2269],{"type":46,"value":2270},"More info",{"type":40,"tag":190,"props":2272,"children":2273},{},[2274,2276,2283],{"type":46,"value":2275},"See ",{"type":40,"tag":220,"props":2277,"children":2281},{"href":2278,"rel":2279},"https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcore\u002Fsdk\u002Ffile-based-apps",[2280],"nofollow",[2282],{"type":46,"value":2278},{"type":46,"value":2284}," for a full reference on file-based apps.",{"type":40,"tag":2286,"props":2287,"children":2288},"style",{},[2289],{"type":46,"value":2290},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2292,"total":2399},[2293,2310,2325,2343,2357,2375,2385],{"slug":2294,"name":2294,"fn":2295,"description":2296,"org":2297,"tags":2298,"stars":22,"repoUrl":23,"updatedAt":2309},"analyzing-dotnet-performance","analyze .NET code for performance anti-patterns","Scans .NET code for ~50 performance anti-patterns across async, memory, strings, collections, LINQ, regex, serialization, and I\u002FO with tiered severity classification. Use when analyzing .NET code for optimization opportunities, reviewing hot paths, or auditing allocation-heavy patterns.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2299,2300,2303,2306],{"name":17,"slug":18,"type":15},{"name":2301,"slug":2302,"type":15},"Code Analysis","code-analysis",{"name":2304,"slug":2305,"type":15},"Debugging","debugging",{"name":2307,"slug":2308,"type":15},"Performance","performance","2026-07-12T08:23:25.400375",{"slug":2311,"name":2311,"fn":2312,"description":2313,"org":2314,"tags":2315,"stars":22,"repoUrl":23,"updatedAt":2324},"android-tombstone-symbolication","symbolicate .NET runtime frames in Android tombstones","Symbolicate the .NET runtime frames in an Android tombstone file. Extracts BuildIds and PC offsets from the native backtrace, downloads debug symbols from the Microsoft symbol server, and runs llvm-symbolizer to produce function names with source file and line numbers. USE FOR triaging a .NET MAUI or Mono Android app crash from a tombstone, resolving native backtrace frames in libmonosgen-2.0.so or libcoreclr.so to .NET runtime source code, or investigating SIGABRT, SIGSEGV, or other native signals originating from the .NET runtime on Android. DO NOT USE FOR pure Java\u002FKotlin crashes, managed .NET exceptions that are already captured in logcat, or iOS crash logs. INVOKES Symbolicate-Tombstone.ps1 script, llvm-symbolizer, Microsoft symbol server.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2316,2317,2320,2321],{"name":17,"slug":18,"type":15},{"name":2318,"slug":2319,"type":15},"Android","android",{"name":2304,"slug":2305,"type":15},{"name":2322,"slug":2323,"type":15},"Microsoft","microsoft","2026-07-12T08:23:21.595572",{"slug":2326,"name":2326,"fn":2327,"description":2328,"org":2329,"tags":2330,"stars":22,"repoUrl":23,"updatedAt":2342},"apple-crash-symbolication","symbolicate .NET runtime frames in crash logs","Symbolicate .NET runtime frames in Apple platform .ips crash logs (iOS, tvOS, Mac Catalyst, macOS). Extracts UUIDs and addresses from the native backtrace, locates dSYM debug symbols, and runs atos to produce function names with source file and line numbers. Automatically downloads .dwarf symbols from the Microsoft symbol server using Mach-O UUIDs. USE FOR triaging a .NET MAUI or Mono app crash from an .ips file on any Apple platform, resolving native backtrace frames in libcoreclr or libmonosgen-2.0 to .NET runtime source code, retrieving .ips crash logs from a connected iOS device or iPhone, or investigating EXC_CRASH, EXC_BAD_ACCESS, SIGABRT, or SIGSEGV originating from the .NET runtime. DO NOT USE FOR pure Swift\u002FObjective-C crashes with no .NET components, or Android tombstone files. INVOKES Symbolicate-Crash.ps1 script, atos, dwarfdump, idevicecrashreport.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2331,2332,2333,2336,2339],{"name":17,"slug":18,"type":15},{"name":2304,"slug":2305,"type":15},{"name":2334,"slug":2335,"type":15},"iOS","ios",{"name":2337,"slug":2338,"type":15},"macOS","macos",{"name":2340,"slug":2341,"type":15},"Observability","observability","2026-07-12T08:23:20.369986",{"slug":2344,"name":2344,"fn":2345,"description":2346,"org":2347,"tags":2348,"stars":22,"repoUrl":23,"updatedAt":2356},"assertion-quality","evaluate assertion quality in test suites","Analyzes the variety and depth of assertions across test suites in any language. Use when the user asks to evaluate assertion quality, find shallow tests, identify assertion-free tests (no assertions or only trivial ones like Assert.IsNotNull \u002F toBeTruthy()), flag self-referential or tautological assertions, measure assertion diversity, or audit whether tests verify different facets of behavior. Polyglot: .NET, Python, TS\u002FJS, Java, Go, Ruby, Rust, Swift, Kotlin, PowerShell, C++. DO NOT USE FOR: writing new tests (use code-testing-agent \u002F writing-mstest-tests), mutation reasoning about whether tests would catch a bug (use test-gap-analysis), or a general severity-ranked anti-pattern audit (use test-anti-patterns), fixing or rewriting assertions, or writing, fixing, or modernizing MSTest tests, assertions, or attributes (use writing-mstest-tests).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2349,2350,2353],{"name":2301,"slug":2302,"type":15},{"name":2351,"slug":2352,"type":15},"QA","qa",{"name":2354,"slug":2355,"type":15},"Testing","testing","2026-07-12T08:23:51.277743",{"slug":2358,"name":2358,"fn":2359,"description":2360,"org":2361,"tags":2362,"stars":22,"repoUrl":23,"updatedAt":2374},"author-component","create and review Blazor components","Create or review Blazor components (.razor files) with correct architecture. USE FOR: writing new Blazor components that do NOT involve JavaScript interop, implementing parameters and EventCallback, RenderFragment slots, component lifecycle (OnInitializedAsync, OnParametersSet), async patterns, IAsyncDisposable, CancellationToken, CSS isolation, code-behind. DO NOT USE FOR: creating new projects (use create-blazor-project), JavaScript interop or calling browser APIs from Blazor (use use-js-interop), forms and validation (use collect-user-input), prerendering issues (use support-prerendering), HTTP data fetching patterns (use fetch-and-send-data), coordinating state between unrelated components (use coordinate-components).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2363,2364,2367,2368,2371],{"name":17,"slug":18,"type":15},{"name":2365,"slug":2366,"type":15},"Blazor","blazor",{"name":13,"slug":14,"type":15},{"name":2369,"slug":2370,"type":15},"UI Components","ui-components",{"name":2372,"slug":2373,"type":15},"Web Development","web-development","2026-07-15T06:03:29.216359",{"slug":2376,"name":2376,"fn":2377,"description":2378,"org":2379,"tags":2380,"stars":22,"repoUrl":23,"updatedAt":2384},"binlog-failure-analysis","analyze MSBuild binary logs","Analyze MSBuild binary logs to diagnose build failures. USE FOR: build errors that are unclear from console output, diagnosing cascading failures across multi-project builds, tracing MSBuild target execution order, and generally any MSBuild build issues. Requires an existing .binlog file. DO NOT USE FOR: generating binlogs (use binlog-generation), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2381,2382,2383],{"name":2301,"slug":2302,"type":15},{"name":2304,"slug":2305,"type":15},{"name":2322,"slug":2323,"type":15},"2026-07-12T08:21:34.637923",{"slug":2386,"name":2386,"fn":2387,"description":2388,"org":2389,"tags":2390,"stars":22,"repoUrl":23,"updatedAt":2398},"binlog-generation","generate MSBuild binary logs for diagnostics","Generate MSBuild binary logs (binlogs) for build diagnostics and analysis. USE FOR: adding \u002Fbl:{} to any dotnet build, test, pack, publish, or restore command to capture a full build execution trace, prerequisite for binlog-failure-analysis and build-perf-diagnostics skills, enabling post-build investigation of errors or performance. Requires MSBuild 17.8+ \u002F .NET 8 SDK+ for {} placeholder; PowerShell needs -bl:{{}}. DO NOT USE FOR: non-MSBuild build systems (npm, Maven, CMake), analyzing an existing binlog (use binlog-failure-analysis instead).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2391,2394,2395],{"name":2392,"slug":2393,"type":15},"Build","build",{"name":2304,"slug":2305,"type":15},{"name":2396,"slug":2397,"type":15},"Engineering","engineering","2026-07-19T05:38:19.340791",96,{"items":2401,"total":2506},[2402,2414,2421,2428,2436,2442,2450,2456,2462,2472,2485,2496],{"slug":2403,"name":2403,"fn":2404,"description":2405,"org":2406,"tags":2407,"stars":2411,"repoUrl":2412,"updatedAt":2413},"multithreaded-task-migration","migrate MSBuild tasks to multithreaded mode","Guide for migrating MSBuild tasks to multithreaded mode support, including compatibility red-team review. Use this when converting tasks to thread-safe versions, implementing IMultiThreadableTask, adding TaskEnvironment support, or auditing migrations for behavioral compatibility.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2408,2409,2410],{"name":17,"slug":18,"type":15},{"name":2396,"slug":2397,"type":15},{"name":2307,"slug":2308,"type":15},5535,"https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fmsbuild","2026-07-22T05:37:33.965588",{"slug":2294,"name":2294,"fn":2295,"description":2296,"org":2415,"tags":2416,"stars":22,"repoUrl":23,"updatedAt":2309},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2417,2418,2419,2420],{"name":17,"slug":18,"type":15},{"name":2301,"slug":2302,"type":15},{"name":2304,"slug":2305,"type":15},{"name":2307,"slug":2308,"type":15},{"slug":2311,"name":2311,"fn":2312,"description":2313,"org":2422,"tags":2423,"stars":22,"repoUrl":23,"updatedAt":2324},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2424,2425,2426,2427],{"name":17,"slug":18,"type":15},{"name":2318,"slug":2319,"type":15},{"name":2304,"slug":2305,"type":15},{"name":2322,"slug":2323,"type":15},{"slug":2326,"name":2326,"fn":2327,"description":2328,"org":2429,"tags":2430,"stars":22,"repoUrl":23,"updatedAt":2342},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2431,2432,2433,2434,2435],{"name":17,"slug":18,"type":15},{"name":2304,"slug":2305,"type":15},{"name":2334,"slug":2335,"type":15},{"name":2337,"slug":2338,"type":15},{"name":2340,"slug":2341,"type":15},{"slug":2344,"name":2344,"fn":2345,"description":2346,"org":2437,"tags":2438,"stars":22,"repoUrl":23,"updatedAt":2356},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2439,2440,2441],{"name":2301,"slug":2302,"type":15},{"name":2351,"slug":2352,"type":15},{"name":2354,"slug":2355,"type":15},{"slug":2358,"name":2358,"fn":2359,"description":2360,"org":2443,"tags":2444,"stars":22,"repoUrl":23,"updatedAt":2374},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2445,2446,2447,2448,2449],{"name":17,"slug":18,"type":15},{"name":2365,"slug":2366,"type":15},{"name":13,"slug":14,"type":15},{"name":2369,"slug":2370,"type":15},{"name":2372,"slug":2373,"type":15},{"slug":2376,"name":2376,"fn":2377,"description":2378,"org":2451,"tags":2452,"stars":22,"repoUrl":23,"updatedAt":2384},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2453,2454,2455],{"name":2301,"slug":2302,"type":15},{"name":2304,"slug":2305,"type":15},{"name":2322,"slug":2323,"type":15},{"slug":2386,"name":2386,"fn":2387,"description":2388,"org":2457,"tags":2458,"stars":22,"repoUrl":23,"updatedAt":2398},{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2459,2460,2461],{"name":2392,"slug":2393,"type":15},{"name":2304,"slug":2305,"type":15},{"name":2396,"slug":2397,"type":15},{"slug":2463,"name":2463,"fn":2464,"description":2465,"org":2466,"tags":2467,"stars":22,"repoUrl":23,"updatedAt":2471},"build-parallelism","optimize MSBuild build parallelism","Diagnose and fix under-parallelized MSBuild builds. USE WHEN a multi-project solution build is slower than expected, doesn't speed up when you add cores, pegs a single core while others idle, or you want to know why `-m` isn't helping. Note: `\u002Fmaxcpucount` default is 1 (sequential) — always pass `-m` for parallel builds. Covers finding the critical path (longest serial ProjectReference chain), graph build (`\u002Fgraph`), BuildInParallel, and solution filters (`.slnf`). DO NOT USE FOR: single-project builds, incremental issues (use incremental-build), compilation slowness inside one project (use build-perf-diagnostics), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2468,2469,2470],{"name":17,"slug":18,"type":15},{"name":2396,"slug":2397,"type":15},{"name":2307,"slug":2308,"type":15},"2026-07-19T05:38:18.364937",{"slug":2473,"name":2473,"fn":2474,"description":2475,"org":2476,"tags":2477,"stars":22,"repoUrl":23,"updatedAt":2484},"build-perf-baseline","establish and optimize build performance baselines","Establish build performance baselines and apply systematic optimization techniques. USE FOR: diagnosing slow builds, establishing before\u002Fafter measurements (cold, warm, no-op scenarios), applying optimization strategies like MSBuild Server, static graph builds, artifacts output, and dependency graph trimming. Start here before diving into build-perf-diagnostics, incremental-build, or build-parallelism. DO NOT USE FOR: non-MSBuild build systems, detailed bottleneck analysis (use build-perf-diagnostics after baselining).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2478,2479,2482,2483],{"name":2396,"slug":2397,"type":15},{"name":2480,"slug":2481,"type":15},"Monitoring","monitoring",{"name":2307,"slug":2308,"type":15},{"name":2354,"slug":2355,"type":15},"2026-07-12T08:21:35.865649",{"slug":2486,"name":2486,"fn":2487,"description":2488,"org":2489,"tags":2490,"stars":22,"repoUrl":23,"updatedAt":2495},"build-perf-diagnostics","diagnose MSBuild build performance bottlenecks","Diagnose MSBuild build performance bottlenecks using binary log analysis. USE FOR: identifying why builds are slow by analyzing binlog performance summaries, detecting ResolveAssemblyReference (RAR) taking >5s, Roslyn analyzers consuming >30% of Csc time, single targets dominating >50% of build time, node utilization below 80%, excessive Copy tasks, NuGet restore running every build. Covers timeline analysis, Target\u002FTask Performance Summary interpretation, and 7 common bottleneck categories. Use after build-perf-baseline has established measurements. DO NOT USE FOR: establishing initial baselines (use build-perf-baseline first), fixing incremental build issues (use incremental-build), parallelism tuning (use build-parallelism), non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2491,2492,2493,2494],{"name":17,"slug":18,"type":15},{"name":2304,"slug":2305,"type":15},{"name":2396,"slug":2397,"type":15},{"name":2307,"slug":2308,"type":15},"2026-07-12T08:21:40.961722",{"slug":2497,"name":2497,"fn":2498,"description":2499,"org":2500,"tags":2501,"stars":22,"repoUrl":23,"updatedAt":2505},"check-bin-obj-clash","detect MSBuild output path conflicts","Detects MSBuild projects with conflicting OutputPath or IntermediateOutputPath. USE FOR: builds failing with 'Cannot create a file when that file already exists', 'The process cannot access the file because it is being used by another process', intermittent build failures that succeed on retry, or missing\u002Foverwritten outputs in multi-project or multi-targeting builds where bin\u002Fobj (or project.assets.json) collide. Common causes: shared OutputPath, missing AppendTargetFrameworkToOutputPath, extra global properties (e.g. PublishReadyToRun), or SetTargetFramework on a ProjectReference to a single-targeting project. DO NOT USE FOR: file access errors unrelated to MSBuild (OS-level locking), single-project single-TFM builds, non-MSBuild build systems.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[2502,2503,2504],{"name":2304,"slug":2305,"type":15},{"name":2396,"slug":2397,"type":15},{"name":2351,"slug":2352,"type":15},"2026-07-19T05:38:14.336279",144]