diff --git a/docs/csharp/fundamentals/tutorials/file-based-programs.md b/docs/csharp/fundamentals/tutorials/file-based-programs.md index 0f0c8bcba8dad..e3357a630eec7 100644 --- a/docs/csharp/fundamentals/tutorials/file-based-programs.md +++ b/docs/csharp/fundamentals/tutorials/file-based-programs.md @@ -84,7 +84,13 @@ On unix, you can run file-based apps directly, typing the source file name on th #!/usr/local/share/dotnet/dotnet run ``` -The location of `dotnet` can be different on different unix installations. Use the command `whence dotnet` to local the `dotnet` host in your environment. +The location of `dotnet` can be different on different unix installations. Use the command `which dotnet` to locate the `dotnet` host in your environment. + +Alternatively, you can use #!/usr/bin/env dotnet to resolve the dotnet path from the PATH environment variable automatically: + +```csharp +#!/usr/bin/env dotnet +``` After making these two changes, you can run the program from the command line directly: @@ -211,7 +217,7 @@ The `System.CommandLine` library offers several key benefits: :::code language="csharp" source="./snippets/file-based-programs/AsciiArt.cs" id="CommandLinePackage"::: > [!IMPORTANT] - > The version `2.0.0-beta6` was the latest version when this tutorial was last updated. If there's a newer version available, use the latest version to ensure you have the latest security packages. Check the package's [NuGet page](https://www.nuget.org/packages/System.CommandLine) for the latest version to ensure you use a package version with the latest security fixes. + > The version `2.0.0` was the latest version when this tutorial was last updated. If there's a newer version available, use the latest version to ensure you have the latest security packages. Check the package's [NuGet page](https://www.nuget.org/packages/System.CommandLine) for the latest version to ensure you use a package version with the latest security fixes. 1. Add the necessary using statements at the top of your file (after the `#!` and `#:package` directives): diff --git a/docs/csharp/fundamentals/tutorials/snippets/file-based-programs/AsciiArt b/docs/csharp/fundamentals/tutorials/snippets/file-based-programs/AsciiArt index 78bb5e08a7b4c..1467798177dff 100755 --- a/docs/csharp/fundamentals/tutorials/snippets/file-based-programs/AsciiArt +++ b/docs/csharp/fundamentals/tutorials/snippets/file-based-programs/AsciiArt @@ -1,7 +1,7 @@ #!/usr/local/share/dotnet/dotnet run #:package Colorful.Console@1.2.15 -#:package System.CommandLine@2.0.0-beta6 +#:package System.CommandLine@2.0.0 using System.CommandLine; using System.CommandLine.Parsing; diff --git a/docs/csharp/fundamentals/tutorials/snippets/file-based-programs/AsciiArt.cs b/docs/csharp/fundamentals/tutorials/snippets/file-based-programs/AsciiArt.cs index 24ba5db893246..761dafc2ebb9a 100755 --- a/docs/csharp/fundamentals/tutorials/snippets/file-based-programs/AsciiArt.cs +++ b/docs/csharp/fundamentals/tutorials/snippets/file-based-programs/AsciiArt.cs @@ -4,7 +4,7 @@ #:package Colorful.Console@1.2.15 // // -#:package System.CommandLine@2.0.0-beta6 +#:package System.CommandLine@2.0.0 // //