From 53b549a2edabfbd2ae7e638f8cd35045fec0583f Mon Sep 17 00:00:00 2001 From: "Andy De George (from Dev Box)" Date: Wed, 8 Apr 2026 09:12:53 -0700 Subject: [PATCH 1/9] chore: ignore .squad/ directory (personal/local, not for shared repos) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index aebb12d48e08f..7376c6752e091 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,7 @@ BenchmarkDotNet.Artifacts # ReplayCheck (temporary) .replaycheck/ +# Squad: entire .squad/ directory is personal/local — not committed to shared repos +.squad/ +# Squad: SubSquad activation file (local to this machine) +.squad-workstream From 27c94f6880aadc356407f74ea327097b15784ca9 Mon Sep 17 00:00:00 2001 From: "Andy De George (from Dev Box)" Date: Wed, 8 Apr 2026 09:45:32 -0700 Subject: [PATCH 2/9] Fix NuGet package naming in .NET tool tutorials (#43983) Rename microsoft.botsay to otsay across the three-part .NET tool tutorial series to avoid teaching users to create packages with reserved company name prefixes on NuGet.org. - global-tools-how-to-create.md: rename project/folder/namespace/package references; add NOTE about avoiding company-owned NuGet prefixes - global-tools-how-to-use.md: update all install/uninstall/dnx commands and output blocks - local-tools-how-to-use.md: update folder, install, manifest JSON, output blocks, and tool list output Fixes #43983 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/core/tools/global-tools-how-to-create.md | 19 +++++++++------- docs/core/tools/global-tools-how-to-use.md | 22 +++++++++---------- docs/core/tools/local-tools-how-to-use.md | 20 ++++++++--------- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/docs/core/tools/global-tools-how-to-create.md b/docs/core/tools/global-tools-how-to-create.md index ae335a37f589c..32ae4b9ed6ea3 100644 --- a/docs/core/tools/global-tools-how-to-create.md +++ b/docs/core/tools/global-tools-how-to-create.md @@ -2,7 +2,7 @@ title: "Tutorial: Create a .NET tool" description: Learn how to create a .NET tool. A tool is a console application that is installed by using the .NET CLI. ms.topic: tutorial -ms.date: 10/27/2021 +ms.date: 04/08/2026 --- # Tutorial: Create a .NET tool using the .NET CLI @@ -30,10 +30,13 @@ This is the first in a series of three tutorials. In this tutorial, you create a 1. Navigate to the *repository* folder and enter the following command: ```dotnetcli - dotnet new console -n microsoft.botsay -f net6.0 + dotnet new console -n botsay -f net6.0 ``` - The command creates a new folder named *microsoft.botsay* under the *repository* folder. + The command creates a new folder named *botsay* under the *repository* folder. + + > [!NOTE] + > For this tutorial, the project is named *botsay*. When you create your own tools, choose a unique package name. Avoid using company or organization name prefixes (such as `Microsoft.` or `Google.`) that you don't own, as those are reserved for those organizations on NuGet.org. > [!NOTE] > For this tutorial you create a tool that targets .NET 6.0. To target a different framework, change the `-f|--framework` option. To target multiple frameworks, change the `TargetFramework` element to a `TargetFrameworks` element in the project file, as shown in the following example: @@ -47,10 +50,10 @@ This is the first in a series of three tutorials. In this tutorial, you create a > > ``` -1. Navigate to the *microsoft.botsay* folder. +1. Navigate to the *botsay* folder. ```console - cd microsoft.botsay + cd botsay ``` ## Add the code @@ -62,7 +65,7 @@ This is the first in a series of three tutorials. In this tutorial, you create a ```csharp using System.Reflection; - namespace microsoft.botsay; + namespace botsay; internal class Program { @@ -167,7 +170,7 @@ All arguments after the `--` delimiter are passed to your application. Before you can pack and distribute the application as a tool, you need to modify the project file. -1. Open the *microsoft.botsay.csproj* file and add three new XML nodes to the end of the `` node: +1. Open the *botsay.csproj* file and add three new XML nodes to the end of the `` node: ```xml true @@ -207,7 +210,7 @@ Before you can pack and distribute the application as a tool, you need to modify dotnet pack ``` - The *microsoft.botsay.1.0.0.nupkg* file is created in the folder identified by the `` value from the *microsoft.botsay.csproj* file, which in this example is the *./nupkg* folder. + The *botsay.1.0.0.nupkg* file is created in the folder identified by the `` value from the *botsay.csproj* file, which in this example is the *./nupkg* folder. When you want to release a tool publicly, you can upload it to `https://www.nuget.org`. Once the tool is available on NuGet, developers can install the tool by using the [dotnet tool install](dotnet-tool-install.md) command. For this tutorial you install the package directly from the local *nupkg* folder, so there's no need to upload the package to NuGet. diff --git a/docs/core/tools/global-tools-how-to-use.md b/docs/core/tools/global-tools-how-to-use.md index f1f45fc4cbf00..f166712f4f96e 100644 --- a/docs/core/tools/global-tools-how-to-use.md +++ b/docs/core/tools/global-tools-how-to-use.md @@ -2,7 +2,7 @@ title: "Tutorial: Install and use a .NET global tool" description: Learn how to install and use a .NET tool as a global tool. ms.topic: tutorial -ms.date: 09/06/2025 +ms.date: 04/08/2026 --- # Tutorial: Install and use a .NET global tool using the .NET CLI @@ -23,7 +23,7 @@ Starting with .NET 10.0.100, you can run .NET tools without permanent installati 1. Run the tool directly using dnx (simplified syntax): ```dotnetcli - dnx microsoft.botsay --add-source ./nupkg microsoft.botsay hello from the bot + dnx botsay --add-source ./nupkg botsay hello from the bot ``` The `--add-source` parameter tells the .NET CLI to use the *./nupkg* directory as an additional source feed for NuGet packages when the tool is not available on NuGet.org. @@ -32,10 +32,10 @@ Starting with .NET 10.0.100, you can run .NET tools without permanent installati If you prefer permanent installation for frequent use: -1. Install the tool from the package by running the [dotnet tool install](dotnet-tool-install.md) command in the *microsoft.botsay* project folder: +1. Install the tool from the package by running the [dotnet tool install](dotnet-tool-install.md) command in the *botsay* project folder: ```dotnetcli - dotnet tool install --global --add-source ./nupkg microsoft.botsay + dotnet tool install --global --add-source ./nupkg botsay ``` The `--global` parameter tells the .NET CLI to install the tool binaries in a default location that is automatically added to the PATH environment variable. @@ -46,7 +46,7 @@ If you prefer permanent installation for frequent use: ```console You can invoke the tool using the following command: botsay - Tool 'microsoft.botsay' (version '1.0.0') was successfully installed. + Tool 'botsay' (version '1.0.0') was successfully installed. ``` [!INCLUDE[](includes/dotnet-tool-install-arch-options.md)] @@ -63,7 +63,7 @@ If you prefer permanent installation for frequent use: 1. Remove the tool by running the [dotnet tool uninstall](dotnet-tool-uninstall.md) command: ```dotnetcli - dotnet tool uninstall -g microsoft.botsay + dotnet tool uninstall -g botsay ``` ## Use the tool as a global tool installed in a custom location @@ -73,13 +73,13 @@ If you prefer permanent installation for frequent use: On Windows: ```dotnetcli - dotnet tool install --tool-path c:\dotnet-tools --add-source ./nupkg microsoft.botsay + dotnet tool install --tool-path c:\dotnet-tools --add-source ./nupkg botsay ``` On Linux or macOS: ```dotnetcli - dotnet tool install --tool-path ~/bin --add-source ./nupkg microsoft.botsay + dotnet tool install --tool-path ~/bin --add-source ./nupkg botsay ``` The `--tool-path` parameter tells the .NET CLI to install the tool binaries in the specified location. If the directory doesn't exist, it is created. This directory is not automatically added to the PATH environment variable. @@ -88,7 +88,7 @@ If you prefer permanent installation for frequent use: ```console You can invoke the tool using the following command: botsay - Tool 'microsoft.botsay' (version '1.0.0') was successfully installed. + Tool 'botsay' (version '1.0.0') was successfully installed. ``` 1. Invoke the tool: @@ -110,13 +110,13 @@ If you prefer permanent installation for frequent use: On Windows: ```dotnetcli - dotnet tool uninstall --tool-path c:\dotnet-tools microsoft.botsay + dotnet tool uninstall --tool-path c:\dotnet-tools botsay ``` On Linux or macOS: ```dotnetcli - dotnet tool uninstall --tool-path ~/bin microsoft.botsay + dotnet tool uninstall --tool-path ~/bin botsay ``` ## Troubleshoot diff --git a/docs/core/tools/local-tools-how-to-use.md b/docs/core/tools/local-tools-how-to-use.md index 41347effd9b12..4525b8fc3db8a 100644 --- a/docs/core/tools/local-tools-how-to-use.md +++ b/docs/core/tools/local-tools-how-to-use.md @@ -2,7 +2,7 @@ title: "Tutorial: Install and use .NET local tools" description: Learn how to install and use a .NET tool as a local tool. ms.topic: tutorial -ms.date: 09/06/2022 +ms.date: 04/08/2026 --- # Tutorial: Install and use a .NET local tool using the .NET CLI @@ -23,7 +23,7 @@ This tutorial teaches you how to install and use a local tool. You use a tool th To install a tool for local access only (for the current directory and subdirectories), it has to be added to a manifest file. -From the *microsoft.botsay* folder, navigate up one level to the *repository* folder: +From the *botsay* folder, navigate up one level to the *repository* folder: ```console cd .. @@ -60,7 +60,7 @@ When you use a CLI command that refers to a local tool, the SDK searches for a m Install the tool from the package that you created in the first tutorial: ```dotnetcli -dotnet tool install --add-source ./microsoft.botsay/nupkg microsoft.botsay +dotnet tool install --add-source ./botsay/nupkg botsay ``` This command adds the tool to the manifest file that you created in the preceding step. The command output shows which manifest file the newly installed tool is in: @@ -68,7 +68,7 @@ This command adds the tool to the manifest file that you created in the precedin ```console You can invoke the tool from this directory using the following command: 'dotnet tool run botsay' or 'dotnet botsay' - Tool 'microsoft.botsay' (version '1.0.0') was successfully installed. + Tool 'botsay' (version '1.0.0') was successfully installed. Entry is added to the manifest file /home/name/repository/.config/dotnet-tools.json ``` @@ -79,7 +79,7 @@ The *.config/dotnet-tools.json* file now has one tool: "version": 1, "isRoot": true, "tools": { - "microsoft.botsay": { + "botsay": { "version": "1.0.0", "commands": [ "botsay" @@ -96,7 +96,7 @@ Once installed as a local tool, you can invoke it in multiple ways: - Run the tool directly using `dnx`: ```dotnetcli - dnx microsoft.botsay --add-source ./nupkg hello from the bot + dnx botsay --add-source ./nupkg hello from the bot ``` > [!NOTE] @@ -125,7 +125,7 @@ You typically install a local tool in the root directory of the repository. Afte "version": 1, "isRoot": true, "tools": { - "microsoft.botsay": { + "botsay": { "version": "1.0.0", "commands": [ "botsay" @@ -154,7 +154,7 @@ You typically install a local tool in the root directory of the repository. Afte The command produces output like the following example: ```console - Tool 'microsoft.botsay' (version '1.0.0') was restored. Available commands: botsay + Tool 'botsay' (version '1.0.0') was restored. Available commands: botsay Tool 'dotnetsay' (version '2.1.3') was restored. Available commands: dotnetsay Restore was successful. ``` @@ -170,7 +170,7 @@ You typically install a local tool in the root directory of the repository. Afte ```console Package Id Version Commands Manifest -------------------------------------------------------------------------------------------- - microsoft.botsay 1.0.0 botsay /home/name/repository/.config/dotnet-tools.json + botsay 1.0.0 botsay /home/name/repository/.config/dotnet-tools.json dotnetsay 2.1.3 dotnetsay /home/name/repository/.config/dotnet-tools.json ``` @@ -203,7 +203,7 @@ The update command finds the first manifest file that contains the package ID an Remove the installed tools by running the [dotnet tool uninstall](dotnet-tool-uninstall.md) command: ```dotnetcli -dotnet tool uninstall microsoft.botsay +dotnet tool uninstall botsay ``` ```dotnetcli From 904c9a41ca6e474a18b724294139a2f7eeda2a69 Mon Sep 17 00:00:00 2001 From: "Andy De George (from Dev Box)" Date: Wed, 8 Apr 2026 11:50:12 -0700 Subject: [PATCH 3/9] Replace botsay tool with dotnet-env in .NET tool tutorials MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the novelty `botsay` ASCII robot tool with `dotnet-env`, a practical tool that reports .NET runtime info, OS details, and key environment variable settings. Changes span the three-part tutorial series and add proper snippet files. - global-tools-how-to-create.md: replace all botsay code and prose with dotnet-env implementation; add snippet reference via :::code:::; add verified dotnet run output block - global-tools-how-to-use.md: update all install/uninstall/dnx commands; fix "may" → "might"; fix "Nuget.org" → "NuGet.org" - local-tools-how-to-use.md: update all commands, manifest JSON, output blocks; remove stale .NET Core 2.1 prerequisite - snippets/global-tools-how-to-create/csharp/Program.cs: new snippet file with four region markers (full-program, main-method, show-info-method, using-directives) - snippets/global-tools-how-to-create/csharp/dotnet-env.csproj: new project file for snippet verification Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/core/tools/global-tools-how-to-create.md | 151 ++++++------------ docs/core/tools/global-tools-how-to-use.md | 34 ++-- docs/core/tools/local-tools-how-to-use.md | 41 +++-- .../csharp/Program.cs | 67 ++++++++ .../csharp/dotnet-env.csproj | 11 ++ 5 files changed, 163 insertions(+), 141 deletions(-) create mode 100644 docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs create mode 100644 docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj diff --git a/docs/core/tools/global-tools-how-to-create.md b/docs/core/tools/global-tools-how-to-create.md index 32ae4b9ed6ea3..97cc2e6bc5990 100644 --- a/docs/core/tools/global-tools-how-to-create.md +++ b/docs/core/tools/global-tools-how-to-create.md @@ -1,6 +1,6 @@ --- title: "Tutorial: Create a .NET tool" -description: Learn how to create a .NET tool. A tool is a console application that is installed by using the .NET CLI. +description: Learn how to create a .NET tool. A tool is a console application that is installed by using the .NET CLI. In this tutorial, you build a tool that reports .NET runtime information, OS details, and key environment variable settings. ms.topic: tutorial ms.date: 04/08/2026 --- @@ -11,7 +11,7 @@ ms.date: 04/08/2026 This tutorial teaches you how to create and package a .NET tool. The .NET CLI lets you create a console application as a tool, which others can install and run. .NET tools are NuGet packages that are installed from the .NET CLI. For more information about tools, see [.NET tools overview](global-tools.md). -The tool that you'll create is a console application that takes a message as input and displays the message along with lines of text that create the image of a robot. +The tool that you'll create is a console application that takes information about the current .NET environment and displays it, including the .NET version, operating system details, and key environment variable settings. This is the first in a series of three tutorials. In this tutorial, you create and package a tool. In the next two tutorials you [use the tool as a global tool](global-tools-how-to-use.md) and [use the tool as a local tool](local-tools-how-to-use.md). The procedures for creating a tool are the same whether you use it as a global tool or as a local tool. @@ -30,13 +30,13 @@ This is the first in a series of three tutorials. In this tutorial, you create a 1. Navigate to the *repository* folder and enter the following command: ```dotnetcli - dotnet new console -n botsay -f net6.0 + dotnet new console -n dotnet-env -f net6.0 ``` - The command creates a new folder named *botsay* under the *repository* folder. + The command creates a new folder named *dotnet-env* under the *repository* folder. > [!NOTE] - > For this tutorial, the project is named *botsay*. When you create your own tools, choose a unique package name. Avoid using company or organization name prefixes (such as `Microsoft.` or `Google.`) that you don't own, as those are reserved for those organizations on NuGet.org. + > For this tutorial, the project is named *dotnet-env*. When you create your own tools, choose a unique package name. Avoid using company or organization name prefixes (such as `Microsoft.` or `Google.`) that you don't own, as those are reserved for those organizations on NuGet.org. > [!NOTE] > For this tutorial you create a tool that targets .NET 6.0. To target a different framework, change the `-f|--framework` option. To target multiple frameworks, change the `TargetFramework` element to a `TargetFrameworks` element in the project file, as shown in the following example: @@ -50,131 +50,78 @@ This is the first in a series of three tutorials. In this tutorial, you create a > > ``` -1. Navigate to the *botsay* folder. +1. Navigate to the *dotnet-env* folder. ```console - cd botsay + cd dotnet-env ``` ## Add the code 1. Open the *Program.cs* file with your code editor. -1. Replace the code in *Program.cs* with the following code: +1. Replace the contents with the following code: - ```csharp - using System.Reflection; + :::code language="csharp" source="./snippets/global-tools-how-to-create/csharp/Program.cs" id="full-program"::: - namespace botsay; + The program has two methods: - internal class Program - { - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } - } - ``` - - The `using System.Reflection;` directive is needed by code that you add in the next step. - -1. Replace the `Main` method with the following code to process the command-line arguments for the application. - - ```csharp - static void Main(string[] args) - { - if (args.Length == 0) - { - var versionString = Assembly.GetEntryAssembly()? - .GetCustomAttribute()? - .InformationalVersion - .ToString(); - - Console.WriteLine($"botsay v{versionString}"); - Console.WriteLine("-------------"); - Console.WriteLine("\nUsage:"); - Console.WriteLine(" botsay "); - return; - } - - ShowBot(string.Join(' ', args)); - } - ``` + - `Main` checks whether any arguments were passed. With no arguments, it calls `ShowInfo()`. With any argument, it prints the tool version. + - `ShowInfo` displays three sections of information: + - **Runtime** — the .NET version, framework description, and runtime identifier, using `Environment.Version` and `RuntimeInformation`. + - **System** — OS description, architecture, machine name, and processor count. + - **Environment Variables** — six key .NET-related variables (`DOTNET_ROOT`, `DOTNET_HOST_PATH`, `DOTNET_CLI_HOME`, `DOTNET_NOLOGO`, `NUGET_PACKAGES`, and `DOTNET_ENVIRONMENT`), showing `(not set)` for any that aren't configured. - If no arguments are passed, a short help message is displayed. Otherwise, all of the arguments are concatenated into a single string and printed by calling the `ShowBot` method that you create in the next step. - -1. Add a new method named `ShowBot` that takes a string parameter. The method prints out the message and an image of a robot using lines of text. - - ```csharp - static void ShowBot(string message) - { - string bot = $"\n {message}"; - bot += @" - __________________ - \ - \ - .... - ....' - .... - .......... - .............'..'.. - ................'..'..... - .......'..........'..'..'.... - ........'..........'..'..'..... - .'....'..'..........'..'.......'. - .'..................'... ...... - . ......'......... ..... - . _ __ ...... - .. # ## ...... - .... . ....... - ...... ....... ............ - ................ ...................... - ........................'................ - ......................'..'...... ....... - .........................'..'..... ....... - ........ ..'.............'..'.... .......... - ..'..'... ...............'....... .......... - ...'...... ...... .......... ...... ....... - ........... ....... ........ ...... - ....... '...'.'. '.'.'.' .... - ....... .....'.. ..'..... - .. .......... ..'........ - ............ .............. - ............. '.............. - ...........'.. .'.'............ - ............... .'.'............. - .............'.. ..'..'........... - ............... .'.............. - ......... .............. - ..... - "; - Console.WriteLine(bot); - } - ``` + The `using System.Reflection` directive is required for `Assembly.GetEntryAssembly()` and `AssemblyInformationalVersionAttribute`. The `using System.Runtime.InteropServices` directive is required for `RuntimeInformation`. 1. Save your changes. ## Test the application -Run the project and see the output. Try these variations at the command line to see different results: +Run the project and see the output: ```dotnetcli dotnet run -dotnet run -- "Hello from the bot" -dotnet run -- Hello from the bot ``` -All arguments after the `--` delimiter are passed to your application. +The output looks similar to the following example: + +```console +dotnet-env v1.0.0 +---------------------------------------- + +Runtime + .NET Version 6.0.36 + Framework .NET 6.0.36 + Runtime Identifier win10-x64 + +System + OS Microsoft Windows 10.0.22631 + Architecture X64 + Machine Name MY-MACHINE + Processor Count 16 + +Environment Variables + DOTNET_ROOT (not set) + DOTNET_HOST_PATH (not set) + DOTNET_CLI_HOME (not set) + DOTNET_NOLOGO (not set) + NUGET_PACKAGES (not set) + DOTNET_ENVIRONMENT (not set) +``` + +> [!NOTE] +> The values shown depend on your machine and .NET installation. The output varies by platform. ## Package the tool Before you can pack and distribute the application as a tool, you need to modify the project file. -1. Open the *botsay.csproj* file and add three new XML nodes to the end of the `` node: +1. Open the *dotnet-env.csproj* file and add three new XML nodes to the end of the `` node: ```xml true - botsay + dotnet-env ./nupkg ``` @@ -196,7 +143,7 @@ Before you can pack and distribute the application as a tool, you need to modify net6.0 true - botsay + dotnet-env ./nupkg @@ -210,7 +157,7 @@ Before you can pack and distribute the application as a tool, you need to modify dotnet pack ``` - The *botsay.1.0.0.nupkg* file is created in the folder identified by the `` value from the *botsay.csproj* file, which in this example is the *./nupkg* folder. + The *dotnet-env.1.0.0.nupkg* file is created in the folder identified by the `` value from the *dotnet-env.csproj* file, which in this example is the *./nupkg* folder. When you want to release a tool publicly, you can upload it to `https://www.nuget.org`. Once the tool is available on NuGet, developers can install the tool by using the [dotnet tool install](dotnet-tool-install.md) command. For this tutorial you install the package directly from the local *nupkg* folder, so there's no need to upload the package to NuGet. diff --git a/docs/core/tools/global-tools-how-to-use.md b/docs/core/tools/global-tools-how-to-use.md index f166712f4f96e..2a8a7eb494128 100644 --- a/docs/core/tools/global-tools-how-to-use.md +++ b/docs/core/tools/global-tools-how-to-use.md @@ -23,7 +23,7 @@ Starting with .NET 10.0.100, you can run .NET tools without permanent installati 1. Run the tool directly using dnx (simplified syntax): ```dotnetcli - dnx botsay --add-source ./nupkg botsay hello from the bot + dnx dotnet-env --add-source ./nupkg ``` The `--add-source` parameter tells the .NET CLI to use the *./nupkg* directory as an additional source feed for NuGet packages when the tool is not available on NuGet.org. @@ -32,21 +32,21 @@ Starting with .NET 10.0.100, you can run .NET tools without permanent installati If you prefer permanent installation for frequent use: -1. Install the tool from the package by running the [dotnet tool install](dotnet-tool-install.md) command in the *botsay* project folder: +1. Install the tool from the package by running the [dotnet tool install](dotnet-tool-install.md) command in the *dotnet-env* project folder: ```dotnetcli - dotnet tool install --global --add-source ./nupkg botsay + dotnet tool install --global --add-source ./nupkg dotnet-env ``` The `--global` parameter tells the .NET CLI to install the tool binaries in a default location that is automatically added to the PATH environment variable. - The `--add-source` parameter tells the .NET CLI to temporarily use the *./nupkg* directory as an additional source feed for NuGet packages. You gave your package a unique name to make sure that it will only be found in the *./nupkg* directory, not on the Nuget.org site. + The `--add-source` parameter tells the .NET CLI to temporarily use the *./nupkg* directory as an additional source feed for NuGet packages. You gave your package a unique name to make sure that it will only be found in the *./nupkg* directory, not on the NuGet.org site. The output shows the command used to call the tool and the version installed: ```console - You can invoke the tool using the following command: botsay - Tool 'botsay' (version '1.0.0') was successfully installed. + You can invoke the tool using the following command: dotnet-env + Tool 'dotnet-env' (version '1.0.0') was successfully installed. ``` [!INCLUDE[](includes/dotnet-tool-install-arch-options.md)] @@ -54,16 +54,16 @@ If you prefer permanent installation for frequent use: 1. Invoke the tool: ```console - botsay hello from the bot + dotnet-env ``` > [!NOTE] - > If this command fails, you may need to open a new terminal to refresh the PATH. + > If this command fails, you might need to open a new terminal to refresh the PATH. 1. Remove the tool by running the [dotnet tool uninstall](dotnet-tool-uninstall.md) command: ```dotnetcli - dotnet tool uninstall -g botsay + dotnet tool uninstall -g dotnet-env ``` ## Use the tool as a global tool installed in a custom location @@ -73,13 +73,13 @@ If you prefer permanent installation for frequent use: On Windows: ```dotnetcli - dotnet tool install --tool-path c:\dotnet-tools --add-source ./nupkg botsay + dotnet tool install --tool-path c:\dotnet-tools --add-source ./nupkg dotnet-env ``` On Linux or macOS: ```dotnetcli - dotnet tool install --tool-path ~/bin --add-source ./nupkg botsay + dotnet tool install --tool-path ~/bin --add-source ./nupkg dotnet-env ``` The `--tool-path` parameter tells the .NET CLI to install the tool binaries in the specified location. If the directory doesn't exist, it is created. This directory is not automatically added to the PATH environment variable. @@ -87,8 +87,8 @@ If you prefer permanent installation for frequent use: The output shows the command used to call the tool and the version installed: ```console - You can invoke the tool using the following command: botsay - Tool 'botsay' (version '1.0.0') was successfully installed. + You can invoke the tool using the following command: dotnet-env + Tool 'dotnet-env' (version '1.0.0') was successfully installed. ``` 1. Invoke the tool: @@ -96,13 +96,13 @@ If you prefer permanent installation for frequent use: On Windows: ```console - c:\dotnet-tools\botsay hello from the bot + c:\dotnet-tools\dotnet-env ``` On Linux or macOS: ```console - ~/bin/botsay hello from the bot + ~/bin/dotnet-env ``` 1. Remove the tool by running the [dotnet tool uninstall](dotnet-tool-uninstall.md) command: @@ -110,13 +110,13 @@ If you prefer permanent installation for frequent use: On Windows: ```dotnetcli - dotnet tool uninstall --tool-path c:\dotnet-tools botsay + dotnet tool uninstall --tool-path c:\dotnet-tools dotnet-env ``` On Linux or macOS: ```dotnetcli - dotnet tool uninstall --tool-path ~/bin botsay + dotnet tool uninstall --tool-path ~/bin dotnet-env ``` ## Troubleshoot diff --git a/docs/core/tools/local-tools-how-to-use.md b/docs/core/tools/local-tools-how-to-use.md index 4525b8fc3db8a..ad976ec87fb16 100644 --- a/docs/core/tools/local-tools-how-to-use.md +++ b/docs/core/tools/local-tools-how-to-use.md @@ -14,16 +14,13 @@ This tutorial teaches you how to install and use a local tool. You use a tool th ## Prerequisites * Complete the [first tutorial of this series](global-tools-how-to-create.md). -* Install the .NET Core 2.1 runtime. * .NET 10.0.100 SDK or later (for `dnx`) - optional but recommended. - For this tutorial you install and use a tool that targets .NET Core 2.1, so you need to have that runtime installed on your machine. To install the 2.1 runtime, go to the [.NET Core 2.1 download page](https://dotnet.microsoft.com/download/dotnet/2.1) and find the runtime installation link in the **Run apps - Runtime** column. - ## Create a manifest file To install a tool for local access only (for the current directory and subdirectories), it has to be added to a manifest file. -From the *botsay* folder, navigate up one level to the *repository* folder: +From the *dotnet-env* folder, navigate up one level to the *repository* folder: ```console cd .. @@ -55,20 +52,20 @@ The tools listed in a manifest file are available to the current directory and s When you use a CLI command that refers to a local tool, the SDK searches for a manifest file in the current directory and parent directories. If it finds a manifest file, but the file doesn't include the referenced tool, it continues the search up through parent directories. The search ends when it finds the referenced tool or it finds a manifest file with `isRoot` set to `true`. -## Install botsay as a local tool (traditional approach) +## Install dotnet-env as a local tool (traditional approach) Install the tool from the package that you created in the first tutorial: ```dotnetcli -dotnet tool install --add-source ./botsay/nupkg botsay +dotnet tool install --add-source ./dotnet-env/nupkg dotnet-env ``` This command adds the tool to the manifest file that you created in the preceding step. The command output shows which manifest file the newly installed tool is in: ```console You can invoke the tool from this directory using the following command: - 'dotnet tool run botsay' or 'dotnet botsay' - Tool 'botsay' (version '1.0.0') was successfully installed. + 'dotnet tool run dotnet-env' or 'dotnet dotnet-env' + Tool 'dotnet-env' (version '1.0.0') was successfully installed. Entry is added to the manifest file /home/name/repository/.config/dotnet-tools.json ``` @@ -79,10 +76,10 @@ The *.config/dotnet-tools.json* file now has one tool: "version": 1, "isRoot": true, "tools": { - "botsay": { + "dotnet-env": { "version": "1.0.0", "commands": [ - "botsay" + "dotnet-env" ] } } @@ -96,22 +93,22 @@ Once installed as a local tool, you can invoke it in multiple ways: - Run the tool directly using `dnx`: ```dotnetcli - dnx botsay --add-source ./nupkg hello from the bot + dnx dotnet-env --add-source ./nupkg ``` > [!NOTE] > When using dnx with a local tool manifest, it automatically uses the version specified in the manifest. -- Using `dotnet botsay`: +- Using `dotnet dotnet-env`: ```dotnetcli - dotnet botsay hello from the bot + dotnet dotnet-env ``` - Using `dotnet tool run` ```dotnetcli - dotnet tool run botsay hello from the bot + dotnet tool run dotnet-env ``` ## Restore a local tool installed by others @@ -125,10 +122,10 @@ You typically install a local tool in the root directory of the repository. Afte "version": 1, "isRoot": true, "tools": { - "botsay": { + "dotnet-env": { "version": "1.0.0", "commands": [ - "botsay" + "dotnet-env" ] }, "dotnetsay": { @@ -154,7 +151,7 @@ You typically install a local tool in the root directory of the repository. Afte The command produces output like the following example: ```console - Tool 'botsay' (version '1.0.0') was restored. Available commands: botsay + Tool 'dotnet-env' (version '1.0.0') was restored. Available commands: dotnet-env Tool 'dotnetsay' (version '2.1.3') was restored. Available commands: dotnetsay Restore was successful. ``` @@ -168,17 +165,17 @@ You typically install a local tool in the root directory of the repository. Afte The output is a list of packages and commands, similar to the following example: ```console - Package Id Version Commands Manifest + Package Id Version Commands Manifest -------------------------------------------------------------------------------------------- - botsay 1.0.0 botsay /home/name/repository/.config/dotnet-tools.json - dotnetsay 2.1.3 dotnetsay /home/name/repository/.config/dotnet-tools.json + dotnet-env 1.0.0 dotnet-env /home/name/repository/.config/dotnet-tools.json + dotnetsay 2.1.3 dotnetsay /home/name/repository/.config/dotnet-tools.json ``` 1. Test the tools: ```dotnetcli dotnet tool run dotnetsay hello from dotnetsay - dotnet tool run botsay hello from botsay + dotnet tool run dotnet-env ``` ## Update a local tool @@ -203,7 +200,7 @@ The update command finds the first manifest file that contains the package ID an Remove the installed tools by running the [dotnet tool uninstall](dotnet-tool-uninstall.md) command: ```dotnetcli -dotnet tool uninstall botsay +dotnet tool uninstall dotnet-env ``` ```dotnetcli diff --git a/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs b/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs new file mode 100644 index 0000000000000..dad6f7b59c810 --- /dev/null +++ b/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs @@ -0,0 +1,67 @@ +// +// +using System.Reflection; +using System.Runtime.InteropServices; +// + +namespace dotnet_env; + +internal class Program +{ + // + static void Main(string[] args) + { + if (args.Length == 0) + { + ShowInfo(); + return; + } + + var versionString = Assembly.GetEntryAssembly()? + .GetCustomAttribute()? + .InformationalVersion + .ToString(); + + Console.WriteLine($"dotnet-env v{versionString}"); + } + // + + // + static void ShowInfo() + { + var versionString = Assembly.GetEntryAssembly()? + .GetCustomAttribute()? + .InformationalVersion + .ToString(); + + Console.WriteLine($"dotnet-env v{versionString}"); + Console.WriteLine(new string('-', 40)); + + Console.WriteLine(); + Console.WriteLine("Runtime"); + Console.WriteLine($" .NET Version {Environment.Version}"); + Console.WriteLine($" Framework {RuntimeInformation.FrameworkDescription}"); + Console.WriteLine($" Runtime Identifier {RuntimeInformation.RuntimeIdentifier}"); + + Console.WriteLine(); + Console.WriteLine("System"); + Console.WriteLine($" OS {RuntimeInformation.OSDescription}"); + Console.WriteLine($" Architecture {RuntimeInformation.OSArchitecture}"); + Console.WriteLine($" Machine Name {Environment.MachineName}"); + Console.WriteLine($" Processor Count {Environment.ProcessorCount}"); + + Console.WriteLine(); + Console.WriteLine("Environment Variables"); + string[] envVars = { "DOTNET_ROOT", "DOTNET_HOST_PATH", + "DOTNET_CLI_HOME", "DOTNET_NOLOGO", + "NUGET_PACKAGES", "DOTNET_ENVIRONMENT" }; + + foreach (string name in envVars) + { + string? value = Environment.GetEnvironmentVariable(name); + Console.WriteLine($" {name,-24}{value ?? "(not set)"}"); + } + } + // +} +// diff --git a/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj b/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj new file mode 100644 index 0000000000000..871a62bbf3f22 --- /dev/null +++ b/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj @@ -0,0 +1,11 @@ + + + + Exe + net6.0 + dotnet_env + enable + enable + + + From c5ea7ca88997925706f7002a90a0f8266af28ef5 Mon Sep 17 00:00:00 2001 From: "Andy De George (from Dev Box)" Date: Wed, 8 Apr 2026 13:33:11 -0700 Subject: [PATCH 4/9] Update .NET version references from 2.1/6.0 to .NET 8 - Update all 'applies to' banners from .NET Core 2.1/.NET Core 3.0 to .NET 8 - Update prerequisites link and prose from .NET SDK 6.0 to .NET 8 - Update dotnet new -f flag from net6.0 to net8.0 - Update multi-target example from net8.0;net6.0 to net9.0;net8.0 - Update sample output Runtime section from 6.0.36 to 8.0.14 - Update project file TargetFramework from net6.0 to net8.0 in both article and snippet Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/core/tools/global-tools-how-to-create.md | 18 +++++++++--------- docs/core/tools/global-tools-how-to-use.md | 2 +- docs/core/tools/local-tools-how-to-use.md | 2 +- .../csharp/dotnet-env.csproj | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/core/tools/global-tools-how-to-create.md b/docs/core/tools/global-tools-how-to-create.md index 97cc2e6bc5990..57a1a3172e21a 100644 --- a/docs/core/tools/global-tools-how-to-create.md +++ b/docs/core/tools/global-tools-how-to-create.md @@ -7,7 +7,7 @@ ms.date: 04/08/2026 # Tutorial: Create a .NET tool using the .NET CLI -**This article applies to:** ✔️ .NET Core 2.1 SDK and later versions +**This article applies to:** ✔️ .NET 8 SDK and later versions This tutorial teaches you how to create and package a .NET tool. The .NET CLI lets you create a console application as a tool, which others can install and run. .NET tools are NuGet packages that are installed from the .NET CLI. For more information about tools, see [.NET tools overview](global-tools.md). @@ -17,9 +17,9 @@ This is the first in a series of three tutorials. In this tutorial, you create a ## Prerequisites -- [.NET SDK 6.0.100](https://dotnet.microsoft.com/download/dotnet/6.0) or a later version. +- [.NET SDK 8.0](https://dotnet.microsoft.com/download/dotnet/8.0) or a later version. - This tutorial uses .NET SDK 6.0, but global tools are available starting in .NET Core SDK 2.1. Local tools are available starting in .NET Core SDK 3.0. + This tutorial uses .NET SDK 8.0. Global tools are available starting in .NET Core SDK 2.1, and local tools are available starting in .NET Core SDK 3.0. - A text editor or code editor of your choice. @@ -30,7 +30,7 @@ This is the first in a series of three tutorials. In this tutorial, you create a 1. Navigate to the *repository* folder and enter the following command: ```dotnetcli - dotnet new console -n dotnet-env -f net6.0 + dotnet new console -n dotnet-env -f net8.0 ``` The command creates a new folder named *dotnet-env* under the *repository* folder. @@ -39,13 +39,13 @@ This is the first in a series of three tutorials. In this tutorial, you create a > For this tutorial, the project is named *dotnet-env*. When you create your own tools, choose a unique package name. Avoid using company or organization name prefixes (such as `Microsoft.` or `Google.`) that you don't own, as those are reserved for those organizations on NuGet.org. > [!NOTE] - > For this tutorial you create a tool that targets .NET 6.0. To target a different framework, change the `-f|--framework` option. To target multiple frameworks, change the `TargetFramework` element to a `TargetFrameworks` element in the project file, as shown in the following example: + > For this tutorial you create a tool that targets .NET 8. To target a different framework, change the `-f|--framework` option. To target multiple frameworks, change the `TargetFramework` element to a `TargetFrameworks` element in the project file, as shown in the following example: > > ```xml > > > Exe - > net8.0;net6.0 + > net9.0;net8.0 > > > ``` @@ -91,8 +91,8 @@ dotnet-env v1.0.0 ---------------------------------------- Runtime - .NET Version 6.0.36 - Framework .NET 6.0.36 + .NET Version 8.0.14 + Framework .NET 8.0.14 Runtime Identifier win10-x64 System @@ -140,7 +140,7 @@ Before you can pack and distribute the application as a tool, you need to modify Exe - net6.0 + net8.0 true dotnet-env diff --git a/docs/core/tools/global-tools-how-to-use.md b/docs/core/tools/global-tools-how-to-use.md index 2a8a7eb494128..f12a2c0acf55f 100644 --- a/docs/core/tools/global-tools-how-to-use.md +++ b/docs/core/tools/global-tools-how-to-use.md @@ -7,7 +7,7 @@ ms.date: 04/08/2026 # Tutorial: Install and use a .NET global tool using the .NET CLI -**This article applies to:** ✔️ .NET Core 2.1 SDK and later versions +**This article applies to:** ✔️ .NET 8 SDK and later versions This tutorial teaches you how to install and use a global tool. You use a tool that you create in the [first tutorial of this series](global-tools-how-to-create.md). diff --git a/docs/core/tools/local-tools-how-to-use.md b/docs/core/tools/local-tools-how-to-use.md index ad976ec87fb16..5e2bb4a4e8669 100644 --- a/docs/core/tools/local-tools-how-to-use.md +++ b/docs/core/tools/local-tools-how-to-use.md @@ -7,7 +7,7 @@ ms.date: 04/08/2026 # Tutorial: Install and use a .NET local tool using the .NET CLI -**This article applies to:** ✔️ .NET Core 3.0 SDK and later versions +**This article applies to:** ✔️ .NET 8 SDK and later versions This tutorial teaches you how to install and use a local tool. You use a tool that you create in the [first tutorial of this series](global-tools-how-to-create.md). diff --git a/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj b/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj index 871a62bbf3f22..6543b8078a10a 100644 --- a/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj +++ b/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 dotnet_env enable enable From 3e5a3e7a3caac926439fa1f2d941eda4b84b4c28 Mon Sep 17 00:00:00 2001 From: "Andy De George (from Dev Box)" Date: Wed, 8 Apr 2026 13:46:22 -0700 Subject: [PATCH 5/9] Update tutorial examples to .NET 10; keep .NET 8 as stated minimum - dotnet new command: -f net8.0 -> -f net10.0 - Prerequisites: link and prose updated to .NET SDK 10.0 - NOTE text: 'targets .NET 8' -> 'targets .NET 10' - Multi-target example: net9.0;net8.0 -> net10.0;net8.0 - Project file XML in prose: net8.0 -> net10.0 - Sample output: updated to real .NET 10.0.4 / win-x64 output (verified via dotnet run) - Snippet .csproj: net8.0 -> net10.0 - Minimum requirement ('applies to' banner and historical notes) unchanged Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/core/tools/global-tools-how-to-create.md | 18 +++++++++--------- .../csharp/dotnet-env.csproj | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/core/tools/global-tools-how-to-create.md b/docs/core/tools/global-tools-how-to-create.md index 57a1a3172e21a..343cb82ba27fe 100644 --- a/docs/core/tools/global-tools-how-to-create.md +++ b/docs/core/tools/global-tools-how-to-create.md @@ -17,9 +17,9 @@ This is the first in a series of three tutorials. In this tutorial, you create a ## Prerequisites -- [.NET SDK 8.0](https://dotnet.microsoft.com/download/dotnet/8.0) or a later version. +- [.NET SDK 10.0](https://dotnet.microsoft.com/download/dotnet/10.0) or a later version. - This tutorial uses .NET SDK 8.0. Global tools are available starting in .NET Core SDK 2.1, and local tools are available starting in .NET Core SDK 3.0. + This tutorial uses .NET SDK 10.0. Global tools are available starting in .NET Core SDK 2.1, and local tools are available starting in .NET Core SDK 3.0. - A text editor or code editor of your choice. @@ -30,7 +30,7 @@ This is the first in a series of three tutorials. In this tutorial, you create a 1. Navigate to the *repository* folder and enter the following command: ```dotnetcli - dotnet new console -n dotnet-env -f net8.0 + dotnet new console -n dotnet-env -f net10.0 ``` The command creates a new folder named *dotnet-env* under the *repository* folder. @@ -39,13 +39,13 @@ This is the first in a series of three tutorials. In this tutorial, you create a > For this tutorial, the project is named *dotnet-env*. When you create your own tools, choose a unique package name. Avoid using company or organization name prefixes (such as `Microsoft.` or `Google.`) that you don't own, as those are reserved for those organizations on NuGet.org. > [!NOTE] - > For this tutorial you create a tool that targets .NET 8. To target a different framework, change the `-f|--framework` option. To target multiple frameworks, change the `TargetFramework` element to a `TargetFrameworks` element in the project file, as shown in the following example: + > For this tutorial you create a tool that targets .NET 10. To target a different framework, change the `-f|--framework` option. To target multiple frameworks, change the `TargetFramework` element to a `TargetFrameworks` element in the project file, as shown in the following example: > > ```xml > > > Exe - > net9.0;net8.0 + > net10.0;net8.0 > > > ``` @@ -91,9 +91,9 @@ dotnet-env v1.0.0 ---------------------------------------- Runtime - .NET Version 8.0.14 - Framework .NET 8.0.14 - Runtime Identifier win10-x64 + .NET Version 10.0.4 + Framework .NET 10.0.4 + Runtime Identifier win-x64 System OS Microsoft Windows 10.0.22631 @@ -140,7 +140,7 @@ Before you can pack and distribute the application as a tool, you need to modify Exe - net8.0 + net10.0 true dotnet-env diff --git a/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj b/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj index 6543b8078a10a..4998f24e65edd 100644 --- a/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj +++ b/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net10.0 dotnet_env enable enable From 205d549384f69784770168a733ab77b8170a0e8f Mon Sep 17 00:00:00 2001 From: "Andy De George (from Dev Box)" Date: Wed, 8 Apr 2026 14:56:51 -0700 Subject: [PATCH 6/9] Remove main method from program --- docs/core/tools/global-tools-how-to-create.md | 40 +------ .../csharp/Program.cs | 100 ++++++++---------- .../csharp/dotnet-env.csproj | 11 +- 3 files changed, 59 insertions(+), 92 deletions(-) diff --git a/docs/core/tools/global-tools-how-to-create.md b/docs/core/tools/global-tools-how-to-create.md index 343cb82ba27fe..412ce1766148d 100644 --- a/docs/core/tools/global-tools-how-to-create.md +++ b/docs/core/tools/global-tools-how-to-create.md @@ -30,26 +30,11 @@ This is the first in a series of three tutorials. In this tutorial, you create a 1. Navigate to the *repository* folder and enter the following command: ```dotnetcli - dotnet new console -n dotnet-env -f net10.0 + dotnet new console -n dotnet-env ``` The command creates a new folder named *dotnet-env* under the *repository* folder. - > [!NOTE] - > For this tutorial, the project is named *dotnet-env*. When you create your own tools, choose a unique package name. Avoid using company or organization name prefixes (such as `Microsoft.` or `Google.`) that you don't own, as those are reserved for those organizations on NuGet.org. - - > [!NOTE] - > For this tutorial you create a tool that targets .NET 10. To target a different framework, change the `-f|--framework` option. To target multiple frameworks, change the `TargetFramework` element to a `TargetFrameworks` element in the project file, as shown in the following example: - > - > ```xml - > - > - > Exe - > net10.0;net8.0 - > - > - > ``` - 1. Navigate to the *dotnet-env* folder. ```console @@ -119,11 +104,7 @@ Before you can pack and distribute the application as a tool, you need to modify 1. Open the *dotnet-env.csproj* file and add three new XML nodes to the end of the `` node: - ```xml - true - dotnet-env - ./nupkg - ``` + :::code language="xml" source="./snippets/global-tools-how-to-create/csharp/dotnet-env.csproj" id="tool-setting"::: `` is an optional element that specifies the command that will invoke the tool after it's installed. If this element isn't provided, the command name for the tool is the assembly name, which is typically the project file name without the *.csproj* extension. @@ -134,22 +115,7 @@ Before you can pack and distribute the application as a tool, you need to modify The project file now looks like the following example: - ```xml - - - - - Exe - net10.0 - - true - dotnet-env - ./nupkg - - - - - ``` + :::code language="xml" source="./snippets/global-tools-how-to-create/csharp/dotnet-env.csproj" id="full"::: 1. Create a NuGet package by running the [dotnet pack](dotnet-pack.md) command: diff --git a/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs b/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs index dad6f7b59c810..fe467e64d8da3 100644 --- a/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs +++ b/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs @@ -1,67 +1,59 @@ -// +// // using System.Reflection; using System.Runtime.InteropServices; // -namespace dotnet_env; - -internal class Program +// +if (args.Length == 0) { - // - static void Main(string[] args) - { - if (args.Length == 0) - { - ShowInfo(); - return; - } + ShowInfo(); + return; +} - var versionString = Assembly.GetEntryAssembly()? - .GetCustomAttribute()? - .InformationalVersion - .ToString(); +var versionString = Assembly.GetEntryAssembly()? + .GetCustomAttribute()? + .InformationalVersion + .ToString(); - Console.WriteLine($"dotnet-env v{versionString}"); - } - // +Console.WriteLine($"dotnet-env v{versionString}"); +// - // - static void ShowInfo() +// +void ShowInfo() +{ + var versionString = Assembly.GetEntryAssembly()? + .GetCustomAttribute()? + .InformationalVersion + .ToString(); + + Console.WriteLine($"dotnet-env v{versionString}"); + Console.WriteLine(new string('-', 40)); + + Console.WriteLine(); + Console.WriteLine("Runtime"); + Console.WriteLine($" .NET Version {Environment.Version}"); + Console.WriteLine($" Framework {RuntimeInformation.FrameworkDescription}"); + Console.WriteLine($" Runtime Identifier {RuntimeInformation.RuntimeIdentifier}"); + + Console.WriteLine(); + Console.WriteLine("System"); + Console.WriteLine($" OS {RuntimeInformation.OSDescription}"); + Console.WriteLine($" Architecture {RuntimeInformation.OSArchitecture}"); + Console.WriteLine($" Machine Name {Environment.MachineName}"); + Console.WriteLine($" Processor Count {Environment.ProcessorCount}"); + + Console.WriteLine(); + Console.WriteLine("Environment Variables"); + string[] envVars = { "DOTNET_ROOT", "DOTNET_HOST_PATH", + "DOTNET_CLI_HOME", "DOTNET_NOLOGO", + "NUGET_PACKAGES", "DOTNET_ENVIRONMENT" }; + + foreach (string name in envVars) { - var versionString = Assembly.GetEntryAssembly()? - .GetCustomAttribute()? - .InformationalVersion - .ToString(); - - Console.WriteLine($"dotnet-env v{versionString}"); - Console.WriteLine(new string('-', 40)); - - Console.WriteLine(); - Console.WriteLine("Runtime"); - Console.WriteLine($" .NET Version {Environment.Version}"); - Console.WriteLine($" Framework {RuntimeInformation.FrameworkDescription}"); - Console.WriteLine($" Runtime Identifier {RuntimeInformation.RuntimeIdentifier}"); - - Console.WriteLine(); - Console.WriteLine("System"); - Console.WriteLine($" OS {RuntimeInformation.OSDescription}"); - Console.WriteLine($" Architecture {RuntimeInformation.OSArchitecture}"); - Console.WriteLine($" Machine Name {Environment.MachineName}"); - Console.WriteLine($" Processor Count {Environment.ProcessorCount}"); - - Console.WriteLine(); - Console.WriteLine("Environment Variables"); - string[] envVars = { "DOTNET_ROOT", "DOTNET_HOST_PATH", - "DOTNET_CLI_HOME", "DOTNET_NOLOGO", - "NUGET_PACKAGES", "DOTNET_ENVIRONMENT" }; - - foreach (string name in envVars) - { - string? value = Environment.GetEnvironmentVariable(name); - Console.WriteLine($" {name,-24}{value ?? "(not set)"}"); - } + string? value = Environment.GetEnvironmentVariable(name); + Console.WriteLine($" {name,-24}{value ?? "(not set)"}"); } - // } +// // diff --git a/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj b/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj index 4998f24e65edd..db91fa409408b 100644 --- a/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj +++ b/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj @@ -1,11 +1,20 @@ + + Exe net10.0 - dotnet_env enable enable + + + true + dotnet-env + ./nupkg + + + From 82deab3e2fe86ae16653b0ecdb2fc7d533547c84 Mon Sep 17 00:00:00 2001 From: "Andy De George (from Dev Box)" Date: Wed, 8 Apr 2026 15:58:19 -0700 Subject: [PATCH 7/9] Adjust snippet ids --- docs/core/tools/global-tools-how-to-create.md | 4 ++-- .../global-tools-how-to-create/csharp/Program.cs | 16 ++++++++-------- .../csharp/dotnet-env.csproj | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/core/tools/global-tools-how-to-create.md b/docs/core/tools/global-tools-how-to-create.md index 412ce1766148d..d3163b72df06a 100644 --- a/docs/core/tools/global-tools-how-to-create.md +++ b/docs/core/tools/global-tools-how-to-create.md @@ -47,7 +47,7 @@ This is the first in a series of three tutorials. In this tutorial, you create a 1. Replace the contents with the following code: - :::code language="csharp" source="./snippets/global-tools-how-to-create/csharp/Program.cs" id="full-program"::: + :::code language="csharp" source="./snippets/global-tools-how-to-create/csharp/Program.cs" id="fullprogram"::: The program has two methods: @@ -104,7 +104,7 @@ Before you can pack and distribute the application as a tool, you need to modify 1. Open the *dotnet-env.csproj* file and add three new XML nodes to the end of the `` node: - :::code language="xml" source="./snippets/global-tools-how-to-create/csharp/dotnet-env.csproj" id="tool-setting"::: + :::code language="xml" source="./snippets/global-tools-how-to-create/csharp/dotnet-env.csproj" id="toolsetting"::: `` is an optional element that specifies the command that will invoke the tool after it's installed. If this element isn't provided, the command name for the tool is the assembly name, which is typically the project file name without the *.csproj* extension. diff --git a/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs b/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs index fe467e64d8da3..5f87e7d965364 100644 --- a/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs +++ b/docs/core/tools/snippets/global-tools-how-to-create/csharp/Program.cs @@ -1,10 +1,10 @@ -// -// +// +// using System.Reflection; using System.Runtime.InteropServices; -// +// -// +// if (args.Length == 0) { ShowInfo(); @@ -17,9 +17,9 @@ .ToString(); Console.WriteLine($"dotnet-env v{versionString}"); -// +// -// +// void ShowInfo() { var versionString = Assembly.GetEntryAssembly()? @@ -55,5 +55,5 @@ void ShowInfo() Console.WriteLine($" {name,-24}{value ?? "(not set)"}"); } } -// -// +// +// diff --git a/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj b/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj index db91fa409408b..c84503665fec3 100644 --- a/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj +++ b/docs/core/tools/snippets/global-tools-how-to-create/csharp/dotnet-env.csproj @@ -8,11 +8,11 @@ enable enable - + true dotnet-env ./nupkg - + From 6d46f2a8aa973c7f003f89972e5fd3f22620f9c3 Mon Sep 17 00:00:00 2001 From: "Andy De George (from Dev Box)" Date: Fri, 10 Apr 2026 14:03:45 -0700 Subject: [PATCH 8/9] REALLY fix snippet id --- docs/core/tools/global-tools-how-to-create.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/tools/global-tools-how-to-create.md b/docs/core/tools/global-tools-how-to-create.md index d3163b72df06a..787176a94bb03 100644 --- a/docs/core/tools/global-tools-how-to-create.md +++ b/docs/core/tools/global-tools-how-to-create.md @@ -104,7 +104,7 @@ Before you can pack and distribute the application as a tool, you need to modify 1. Open the *dotnet-env.csproj* file and add three new XML nodes to the end of the `` node: - :::code language="xml" source="./snippets/global-tools-how-to-create/csharp/dotnet-env.csproj" id="toolsetting"::: + :::code language="xml" source="./snippets/global-tools-how-to-create/csharp/dotnet-env.csproj" id="toolsettings"::: `` is an optional element that specifies the command that will invoke the tool after it's installed. If this element isn't provided, the command name for the tool is the assembly name, which is typically the project file name without the *.csproj* extension. From 421eafdded01fdb4fa2dee5c6acc12b3528d2833 Mon Sep 17 00:00:00 2001 From: "Andy De George (from Dev Box)" Date: Fri, 10 Apr 2026 14:42:31 -0700 Subject: [PATCH 9/9] Revert "chore: ignore .squad/ directory (personal/local, not for shared repos)" This reverts commit 53b549a2edabfbd2ae7e638f8cd35045fec0583f. --- .gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitignore b/.gitignore index 7376c6752e091..aebb12d48e08f 100644 --- a/.gitignore +++ b/.gitignore @@ -64,7 +64,3 @@ BenchmarkDotNet.Artifacts # ReplayCheck (temporary) .replaycheck/ -# Squad: entire .squad/ directory is personal/local — not committed to shared repos -.squad/ -# Squad: SubSquad activation file (local to this machine) -.squad-workstream