gluck / il-repack

Open-source alternative to ILMerge
Apache License 2.0
1.19k stars 217 forks source link

'dotnet ilrepack' results in 'command not found' #378

Closed fourpastmidnight closed 1 month ago

fourpastmidnight commented 1 month ago

I just tried to install ILRepack as a dotnet tool, according to the release notes on v2.0.35. After determining that the tool package name is dotnet-ilrepack, I was informed that the tool was installed successfully:

You can invoke the tool using the following command: ilrepack
Tool 'dotnet-ilrepack' (version '1.0.1') was successfully installed.

I find it odd that the version of the tool, 1.0.1, is different than the released version of the executable, 2.0.35. I mean, I suppose that's fine if the tool package version is 1.0.1. So that's why my first order of business was to run the tool with the /help argument--to make sure that I had the latest ILRepack version of 2.0.35. So I proceeded to execute the tool:

PS C:\> dotnet ilrepack /help

but was met with an error:

Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-ilrepack does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
fourpastmidnight commented 1 month ago

I discovered the problem. I wondered if perhaps the tool was installed incorrectly, and it is.

In my home directory, C:\Users\<MyUsername>\.dotnet\tools folder, all other tools I have installed have the nomenclature dotnet-<toolname>.exe, but ILRepack was simply ilrepack.exe. When I renamed ilrepack.exe to dotnet-ilrepack.exe, running dotnet ilrepack /help worked.

However, there is the added problem that the tool really is v1.0.1 and has not been updated to v2.0.35.

KirillOsenkov commented 1 month ago

you can install using dotnet-ilrepack, but run just using ilrepack without dotnet. The version of the tool is decoupled from the library.

None of it is a bug but it does need to be documented.

fourpastmidnight commented 1 month ago

I updated pull request #377 with what you said above that details installing ILRepack using dotnet tool install -g and running it without the need to use dotnet ilrepack, but instead simply ilrepack.

Thanks!

KirillOsenkov commented 1 month ago

Fixed with #377