Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 17, 2025

Summary

The #! preprocessor directive example used a hardcoded dotnet path that only works on specific installations. Updated to use /usr/bin/env for portability across Unix and macOS distributions.

Changed:

  • Shebang from #!/usr/local/share/dotnet/dotnet run to #!/usr/bin/env dotnet run
  • Explanation text to clarify the /usr/bin/env locates dotnet in PATH

Fixes #49924

Original prompt

This section details on the original issue you should resolve

<issue_title>The #! directive should be #!/usr/bin/env dotnet</issue_title>
<issue_description>### Type of issue

Outdated article

Description

See #49923

Page URL

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives

Content source URL

https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/preprocessor-directives.md

Document Version Independent Id

501be68d-5ad0-18d9-8958-54215bb57fc0

Platform Id

84295fdd-62d6-f945-9adf-cc56ef16aa70

Article author

@BillWagner

Metadata

  • ID: 716913e5-dbbe-bdb0-909a-4d8c2dc7be97
  • PlatformId: 84295fdd-62d6-f945-9adf-cc56ef16aa70
  • Service: dotnet-csharp
  • Sub-service: lang-reference

Related Issues</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Internal previews

📄 File 🔗 Preview link
docs/csharp/language-reference/preprocessor-directives.md docs/csharp/language-reference/preprocessor-directives

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copilot AI changed the title [WIP] Update shebang directive to use env for dotnet Update shebang directive to use portable env format Nov 17, 2025
Copilot finished work on behalf of BillWagner November 17, 2025 15:01
Copilot AI requested a review from BillWagner November 17, 2025 15:01
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ready for final review.

@BillWagner BillWagner marked this pull request as ready for review November 17, 2025 15:59
@BillWagner BillWagner requested a review from a team as a code owner November 17, 2025 15:59
Copilot AI review requested due to automatic review settings November 17, 2025 15:59
@BillWagner BillWagner enabled auto-merge (squash) November 17, 2025 15:59
Copilot finished reviewing on behalf of BillWagner November 17, 2025 16:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the shebang directive example in the C# preprocessor directives documentation to use a portable format that works across different Unix and macOS distributions.

Key changes:

  • Updated shebang from hardcoded path #!/usr/local/share/dotnet/dotnet run to portable #!/usr/bin/env dotnet run
  • Enhanced explanation to clarify how /usr/bin/env locates the dotnet executable in PATH

@BillWagner BillWagner merged commit 9b217d6 into main Nov 17, 2025
22 checks passed
@BillWagner BillWagner deleted the copilot/update-shebang-directive branch November 17, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The #! directive should be #!/usr/bin/env dotnet hello

3 participants