Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the path of the nuget package i just installed

Given I have just installed the most recent version of a package using nuget (using powershell), outside of a solution or project folder e.g. PS> nuget install octopustools then a directory is created below the current folder, in this case \OctopusTools.4.22.1.

I want to access the exe inside the package that has relative path \OctopusTools.4.22.1\tools\octo.exe. However I want an easy way to know the path in my script because the version number can change based on releases.

Is there easy way to get nuget to tell me the name of the folder it has just installed to, i.e. OctopusTools.4.22.1?

I want to avoid guessing the path based on recursivly scanning folders or hardcoding the version number if possible. The docs do not seem to offer anything obvious?

like image 816
alastairtree Avatar asked Nov 22 '25 15:11

alastairtree


1 Answers

If using PowerShell Install-Package cmdlet you can get the newly installed Octopus Tools folder and add it to the path (which is why I imagine you want to know where it is installed) as follows:

PS>Install-Package -Name OctopusTools -Force
PS>$octoPath = (Get-Item((Get-Package -Name OctopusTools).Source)).DirectoryName +"\tools"
PS>$octoPath
PS>$env:Path += $env:Path + $octoPath
like image 136
Caltor Avatar answered Nov 25 '25 11:11

Caltor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!