-
Notifications
You must be signed in to change notification settings - Fork 113
Support packaging as a dotnet tool #1547
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1547 +/- ##
=======================================
- Coverage 90.2% 90.2% -0.1%
=======================================
Files 423 423
Lines 35476 35476
Branches 2209 2209
=======================================
- Hits 32021 32020 -1
Misses 3001 3001
- Partials 454 455 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 adds support for packaging Component Detection as a .NET global tool by setting PackAsTool=true and defining ToolCommandName=component-detection in the project file.
Key changes:
- Enables the project to be packaged as a .NET global tool that users can install via
dotnet tool install - Sets the command name to
component-detectionfor invoking the tool after installation
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <RuntimeIdentifiers>win-x64;linux-x64;osx-x64;win-arm64;linux-arm64;osx-arm64</RuntimeIdentifiers> |
Copilot
AI
Nov 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RuntimeIdentifiers property should not be used together with PackAsTool=true. .NET global tools are designed to be framework-dependent and cross-platform. The RuntimeIdentifiers property is for creating runtime-specific self-contained executables, which conflicts with the dotnet tool packaging model.
When dotnet pack runs with both properties set, it may create multiple RID-specific tool packages instead of a single cross-platform tool package, or the tool may not install/run correctly.
Consider one of these approaches:
- Remove
RuntimeIdentifiersfrom the project file and specify it only on the command line when runningdotnet publishfor self-contained builds (the release workflow already does this) - Create a separate project specifically for the dotnet tool packaging without
RuntimeIdentifiers
The release workflow already specifies --runtime explicitly for self-contained builds, so removing RuntimeIdentifiers from the project file shouldn't affect those builds.
| <RuntimeIdentifiers>win-x64;linux-x64;osx-x64;win-arm64;linux-arm64;osx-arm64</RuntimeIdentifiers> |
See https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools-how-to-create