Octo.exe & Powershell

Hi, for my project I have a powershell script that runs post build which combines a few different dll’s into a folder. This folder is what is needed to be uploaded to Octopus repository as a package. I’ve tried creating a nuget package out of the folder with no luck. So i’m now creating a zip folder. As far as i’m aware it’s possible to use Octo.exe to push the zip file to the Octopus repository, but i can’t get the code working out of powershell.

The command i have is

Octo.exe push --package MyPackage + "$VersionDLL + ".zip --replace-existing --server http://myserver --apiKey API-#########

My guess is that this is a CMD script therefore is there a way of either getting the command to run in powershell or if i have to push it to a CMD command how do i do it so that the powershell variable $VersionDLL is correct and not null?

Hi,

Thanks for reaching out.

It looks like you are not joining the Package name string properly. Try this instead:

Octo.exe push --package ("MyPackage" + $VersionDLL + ".zip") --replace-existing --server http://myserver --apiKey API-#########

Thanks,
Dalmiro

Thank you for reply Dalmiro

Is the powershell command Invoke-ASCmd correct before the Octo.exe?

I’m currently getting the error :

Invoke-ASCmd : A positional parameter cannot be found that accepts argument ‘Octo.exe’.
At C:\Users\sharrison\Desktop\Test\New-NuGetPackage.ps1:1 char:1

  • Invoke-ASCmd Octo.exe push --package (“Zygo.Service.Host.zip”) --replace-existin …
  •   + CategoryInfo          : InvalidArgument: (:) [Invoke-ASCmd], ParameterBindingException
      + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.AnalysisServices.PowerShell.Cmdlets.ExecuteScriptCommand
    
    

After implementing your changes

Thank you

Hi Shawn,

Invoke-ASCmd doesn’t seem to do what its name implies. Apparently its something related to SQL server https://msdn.microsoft.com/en-us/library/hh479579.aspx

The below should work. If it doesn’t, I’m afraid the best thing would be to contact one of your teammates that’s skilled in Powershell to give you a hand. This is mostly a PS syntax error, and not an Octopus one. Kinda hard for me to troubleshoot if I don’t know the context on which you are executing this command. Someone that’s sitting next to you might solve this in 2 seconds :slight_smile:

$Octoexe = "C:\tools\Octo.exe" #Put your own path here
& $Octoexe push --package ("MyPackage" + $VersionDLL + ".zip") --replace-existing --server http://myserver --apiKey API-#########

Regards,
Dalmiro

That worked, Thank you very much for your help Dalmiro