spouliot/appcompare

Unable to run when installed using "dotnet tool install"

tipa opened this issue · 7 comments

tipa commented

Initially reported here: xamarin/xamarin-macios#10249 (comment)
185203974-0c957f9e-2713-48d3-8bf6-01e3e4ac260a

The acquisition/update of the tool, via dotnet tool, is out of my control - it's a dotnet feature.

I suspect something is wrong in your PATH so the symlinks created by dotnet tools are not accessible.

The symlinks are created under ~/.dotnet/tools, that's what I have locally

l ~/.dotnet/tools                                                                                                                                                           total 2040
drwxr-xr-x   10 poupou  staff   320B 22 Aug 17:04 .
drwxr-xr-x  107 poupou  staff   3.3K 17 Aug 13:11 ..
drwxr-xr-x   10 poupou  staff   320B 22 Aug 17:04 .store
-rwxr-xr-x    1 poupou  staff   144K 22 Aug 17:04 appcompare
-rwxr-xr-x    1 poupou  staff   144K 13 Feb  2022 cilout
-rwxr-xr-x    1 poupou  staff   144K 20 Apr 20:09 dotnet-cake
-rwxr-xr-x    1 poupou  staff   144K  7 Feb  2022 dotnet-releaser
-rwxr-xr-x    1 poupou  staff   129K  1 Mar 20:58 dotnet-trace
-rwxr-xr-x    1 poupou  staff   144K 22 Dec  2021 ilspycmd
-rwxr-xr-x    1 poupou  staff   144K  8 Aug 11:39 uno-check

and ~/.dotnet/tools is part of my PATH, which you can see with exports, e.g.

$ export | grep ~/.dotnet/tools                                                                                                                                               PATH='/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/poupou/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands'

Actually it seems I have it twice as ~/.dotnet/tools and /Users/poupou/.dotnet/tools - not quite sure why, it's part of dotnet installation.

tipa commented

$ export | grep ~/.dotnet/tools

There no cmd output when I call this

And that's what I see in the ~/.dotnet/tools folder
Screenshot 2022-08-22 at 23 24 49

echo $PATH puts out this:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

My bad. There's no output because ~ gets expanded by the shell to /Users/timopartl and this one is not in your PATH. It worked for me because both entries are present.

Can you run dotnet-cake ?

$ dotnet-cake                                                                                                                                        
Error: Bootstrapping failed for '/Users/poupou/git/external/uno/uno/build.cake'.
build.cake, line #0: Could not find script '/Users/poupou/git/external/uno/uno/build.cake'.
tipa commented

this also give an error :(
zsh: command not found: dotnet-cake

Maybe there's simply some dotnet issue on my machine, completely unrelated to your tool...

yeah, I don't see how it could be related to appcompare.

OTOH adding /Users/timopartl/.dotnet/tools to your PATH would probably solve the issue :)

tipa commented

It indeed does! Thanks for your help, despite this not being a problem of your tool at all.
Looking forward to using it

Btw, newer .NET SDKs seem to give a warning on the tool installation when the PATH doesn't include the tool directory. It shows instructions on how to correct that:

filipnavara@172-4-1-20 emclient-temp % dotnet tool install -g appcompare  
Tools directory '/Users/filipnavara/.dotnet/tools' is not currently on the PATH environment variable.
If you are using zsh, you can add it to your profile by running the following command:

cat << \EOF >> ~/.zprofile
# Add .NET Core SDK tools
export PATH="$PATH:/Users/filipnavara/.dotnet/tools"
EOF

And run `zsh -l` to make it available for current session.

You can only add it to the current session by running the following command:

export PATH="$PATH:/Users/filipnavara/.dotnet/tools"

You can invoke the tool using the following command: appcompare
Tool 'appcompare' (version '2.3.0') was successfully installed.