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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With