From 18ce1c9b48fbbb3f821cc97156983c92d6073f78 Mon Sep 17 00:00:00 2001 From: Nigusu Solomon Yenework <59111203+Nigusu-Allehu@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:20:34 -0800 Subject: [PATCH 1/3] Document dotnet tools plugin usage --- .../NuGet-Cross-Platform-Plugins.md | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md b/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md index 02428709d..00ca35e03 100644 --- a/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md +++ b/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md @@ -99,6 +99,48 @@ The plugin entry point will be the name of the installed folder, with the .dll e > [!Note] > There is currently no user story for the installation of the plugins. It's as simple as moving the required files into the predetermined location. +### Support for Plugins Installed as .NET Tools + +Starting 6.13, NuGet now supports plugins installed as global .NET tools. This enables plugin authors to publish their plugins as .NET tools, simplifying the deployment process. + +#### Key Features + +1. Plugins installed as .NET tools must follow a naming convention: **`nuget-plugin-*`**. +2. Upon installation, these plugins are added to the `PATH` by the .NET SDK. NuGet scans the `PATH` environment variable for executables with names starting with `nuget-plugin-`. +3. On Windows, NuGet looks for `.exe` or `.bat` files, while on Linux and macOS, it identifies plugins by checking for the executable bit. +4. These plugins are launched in a separate process, consistent with the existing design. + +#### Example Workflow + +**For Plugin Authors:** + +1. Add the following property to the plugin project: + + ```xml + + true + nuget-plugin-myplugin + + ``` + +2. Publish the plugin as a .NET tool using `dotnet pack`. + +**For Consumers:** + +1. Install the plugin using: + + ```bash + dotnet tool install -g nuget-plugin-myplugin + ``` + +2. Use the plugin seamlessly in scenarios requiring NuGet authentication or operations like `dotnet restore --interactive`. + +> **Note:** Plugins installed as .NET tools provide a consistent experience across .NET Core and .NET Framework, eliminating the need to maintain separate plugins for each framework. + +### Security Considerations + +.NET tools run in full trust. It is essential to install only trusted plugins. While this is not a new concern, users should be aware of the risks when installing NuGet plugins via .NET tools. + ## Supported operations Two operations are supported under the new plugin protocol. From eba36dacd6171dd2ab35579c25aa4d87eef9382e Mon Sep 17 00:00:00 2001 From: Nigusu Solomon Yenework <59111203+Nigusu-Allehu@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:31:58 -0800 Subject: [PATCH 2/3] env variable --- docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md b/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md index 00ca35e03..a19a6acc0 100644 --- a/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md +++ b/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md @@ -71,6 +71,7 @@ CI/CD scenarios and power users can use environment variables to override the be - `NUGET_NETFX_PLUGIN_PATHS` - defines the plugins that will be used by the .NET Framework based tooling (NuGet.exe/MSBuild.exe/Visual Studio). Takes precedence over `NUGET_PLUGIN_PATHS`. (NuGet version 5.3+ only) - `NUGET_NETCORE_PLUGIN_PATHS` - defines the plugins that will be used by the .NET Core based tooling (dotnet.exe). Takes precedence over `NUGET_PLUGIN_PATHS`. (NuGet version 5.3+ only) - `NUGET_PLUGIN_PATHS` - defines the plugins that will be used for that NuGet process, priority preserved. If this environment variable is set, it overrides the convention based discovery. Ignored if either of the framework specific variables is specified. + - Starting 6.13, this can also be used to specify a path to a .Net tools plugin path. - User-location, the NuGet Home location in `%UserProfile%/.nuget/plugins`. This location cannot be overriden. A different root directory will be used for .NET Core and .NET Framework plugins. | Framework | Root discovery location | From 7de8612caa8518efe9e5c6757f6b71deee985c4a Mon Sep 17 00:00:00 2001 From: Nigusu Solomon Yenework <59111203+Nigusu-Allehu@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:34:00 -0800 Subject: [PATCH 3/3] Update NuGet-Cross-Platform-Plugins.md --- .../reference/extensibility/NuGet-Cross-Platform-Plugins.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md b/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md index a19a6acc0..05810650c 100644 --- a/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md +++ b/docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md @@ -70,8 +70,10 @@ CI/CD scenarios and power users can use environment variables to override the be - `NUGET_NETFX_PLUGIN_PATHS` - defines the plugins that will be used by the .NET Framework based tooling (NuGet.exe/MSBuild.exe/Visual Studio). Takes precedence over `NUGET_PLUGIN_PATHS`. (NuGet version 5.3+ only) - `NUGET_NETCORE_PLUGIN_PATHS` - defines the plugins that will be used by the .NET Core based tooling (dotnet.exe). Takes precedence over `NUGET_PLUGIN_PATHS`. (NuGet version 5.3+ only) -- `NUGET_PLUGIN_PATHS` - defines the plugins that will be used for that NuGet process, priority preserved. If this environment variable is set, it overrides the convention based discovery. Ignored if either of the framework specific variables is specified. - - Starting 6.13, this can also be used to specify a path to a .Net tools plugin path. +- `NUGET_PLUGIN_PATHS` + - defines the plugins that will be used for that NuGet process, priority preserved. If this environment variable is set, it overrides the convention based discovery. Ignored if either of the framework specific variables is specified. + + - Starting 6.13, this can also be used to specify a path to a .Net tools plugin path. - User-location, the NuGet Home location in `%UserProfile%/.nuget/plugins`. This location cannot be overriden. A different root directory will be used for .NET Core and .NET Framework plugins. | Framework | Root discovery location |