From 2c4434c268a36a9be719ceada712d10c6ce4257f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 17 Nov 2025 14:54:36 +0000 Subject: [PATCH 1/2] Initial plan From b9247642f1d72bd3ffbbcdfb7a8a87abdaa5141b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 17 Nov 2025 14:58:37 +0000 Subject: [PATCH 2/2] Update shebang directive to use portable env format Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com> --- docs/csharp/language-reference/preprocessor-directives.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/csharp/language-reference/preprocessor-directives.md b/docs/csharp/language-reference/preprocessor-directives.md index 0634dea29a2df..45227fac3a27b 100644 --- a/docs/csharp/language-reference/preprocessor-directives.md +++ b/docs/csharp/language-reference/preprocessor-directives.md @@ -56,11 +56,11 @@ The C# compiler ignores any preprocessor directive that starts with `#:` or `#!` The `#!` preprocessor directive enables unix shells to directly execute a C# file using `dotnet run`. For example: ```csharp -#!/usr/local/share/dotnet/dotnet run +#!/usr/bin/env dotnet run Console.WriteLine("Hello"); ``` -The preceding code snippet informs a Unix shell to execute the file using `/usr/local/share/dotnet/dotnet run`. (Your installation directory for the `dotnet` CLI can be different on different Unix or macOS distributions). The `#!` line must be the first line in the file, and the following tokens are the program to run. You need to enable the *execute* (`x`) permission on the C# file for that feature. +The preceding code snippet informs a Unix shell to execute the file using `dotnet run`. The `/usr/bin/env` command locates the `dotnet` executable in your PATH, making this approach portable across different Unix and macOS distributions. The `#!` line must be the first line in the file, and the following tokens are the program to run. You need to enable the *execute* (`x`) permission on the C# file for that feature. The `#:` directives that are used in file-based apps include: