Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document dotnet tools plugin usage #3379

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Nigusu-Allehu
Copy link
Contributor

@Nigusu-Allehu Nigusu-Allehu requested review from a team as code owners December 6, 2024 00:21
Copy link

Learn Build status updates of commit 18ce1c9:

✅ Validation status: passed

File Status Preview URL Details
docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@Nigusu-Allehu Nigusu-Allehu self-assigned this Dec 6, 2024
Copy link

Learn Build status updates of commit eba36da:

✅ Validation status: passed

File Status Preview URL Details
docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

Copy link

Learn Build status updates of commit 7de8612:

✅ Validation status: passed

File Status Preview URL Details
docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:


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.
Copy link
Member

Choose a reason for hiding this comment

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

Is this in addition to #1?

So how does one ship a global tool that works on both linux & windows?

Copy link
Contributor Author

@Nigusu-Allehu Nigusu-Allehu Jan 16, 2025

Choose a reason for hiding this comment

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

Sorry I was confused about this because I clicked on #1 and it ssays 47 files changed, and I couldn't figure out how it was related to this PR. Now, I understand you meant to ask about bullet point number 1. Yes, all dotnet tool plugins are expected to follow the naming conventions in number 1. Shipping a global package is enabled by dotnet pack as discussed https://github.com/dotnet/docs/blob/main/docs/core/tools/global-tools-how-to-create.md. I have update the doc to link the instructions

Copy link

Learn Build status updates of commit 2ceb6cf:

💡 Validation status: suggestions

File Status Preview URL Details
docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md 💡Suggestion View Details

docs/reference/extensibility/NuGet-Cross-Platform-Plugins.md

  • Line 116, Column 80: [Suggestion: learn-site-link-broken - See documentation] Link '/dotnet/core/tools/global-tools-how-to-create.md' points to a learn site page that doesn't exist. Check the path or URL and update the link.

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

For any questions, please:

Copy link
Member

@nkolev92 nkolev92 left a comment

Choose a reason for hiding this comment

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

This doc is authored more as a conceptual doc, but the tone of the changes feels like more of a pitch.
 
I think the language should be tweaked to be more "matter of fact" way.

- `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.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Starting 6.13, this can also be used to specify a path to a .Net tools plugin path.
- Starting 6.13, this can also be used to specify a path to a .NET tools plugin path.
- ```

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. In addition to number 1, 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.
Copy link
Member

Choose a reason for hiding this comment

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

I think this type of information made sense in the design, but this document is talking about all plugins period, so I think we can remove it.


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. In addition to number 1, on Windows, NuGet looks for `.exe` or `.bat` files, while on Linux and macOS, it identifies plugins by checking for the executable bit.
Copy link
Member

Choose a reason for hiding this comment

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

I think these are in a way separate features.

The support is that nuget-plugin-* is looked from the path, the fact that .NET tools are how it's going to be done is a separate.

This document serves as more of a reference, telling you how things work.


#### Example Workflow

**For Plugin Authors:**
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think is too much detail.
Say it can be installed as a .NET tool by linking and it's enough.

It doesn't need to be a step by step guide.

```xml
<PropertyGroup>
<PackAsTool>true</PackAsTool>
<ToolCommandName>nuget-plugin-myplugin</ToolCommandName>
Copy link
Member

Choose a reason for hiding this comment

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

My suggestion would be remove this, but package name and tool command name aren't necessarily the same.


### 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.
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this apply to plugins in general?
Should this be a generic statement?

dotnet tool install -g nuget-plugin-myplugin
```

2. Use the plugin seamlessly in scenarios requiring NuGet authentication or operations like `dotnet restore --interactive`.
Copy link
Member

Choose a reason for hiding this comment

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

I think we should remove this is. People would normally expect that the tools regardless of how they're installed would work the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document .net tools Plugin feature
2 participants