NightOwl888 commented on issue #1004:
URL: https://github.com/apache/lucenenet/issues/1004#issuecomment-2447994792

   What I meant was `dotnet tool restore` does not install the tool if it does 
not already exist on the system. So, it took a while to work out that I needed 
to use `dotnet tool install` instead.
   
   There are a few problems with this approach:
   
   1. It isn't clear where the tool is being physically installed on the 
machine and whether it is being done in a custom way in a virtual environment.
   2. GitHub Actions does not use the system path, it uses a [text 
file](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path).
 If `dotnet tool` updates the system path, it has no effect in the virtual 
environment.
   3. Since it isn't clear where the tool is, we have to search for it by 
outputting the files in the log.
   4. When I finally did figure out where the tool was, adding it to the path 
didn't even work. If it is not supposed to be, then that probably explains why 
this didn't work. But that wasn't clear.
   
   It is simpler to understand if the path is *inside* of our repo directory 
than to have it install it in some magic directory on the machine. We don't 
have to worry about whether the current CI environment knows where the tool is, 
because we know. It is very clear by looking at the script where the tool is. 
And we can be 100% sure we don't have to touch any settings on the environment 
to get it to function, so it will be portable across all environments.
   
   I am not sure why we would ever need to use `dotnet tool restore`. If we use 
a versioned local folder to store the tool locally, we could just check for the 
existence of the version folder. If it is there, run it. If not, create the 
folder and install it using `dotnet tool install` with `--tool-path`. The tool 
would never be out of date. Then at some future date when we upgrade the 
version, it will be able to accommodate both versions on the same machine by 
switching commits/branches because the version folders would be side by side.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to