I am using power shell to run octo.exe to pack my folder. If I do not include the -version every thing works fine. If I run the write-host output from the commend line it works fine. However if I run the powershell script I get this error.
PS C:\Windows\system32> D:\PowerShellForTeamCity\DebugBuildzip.ps1
D:\octopus\octo.exe pack -id=JCRL3G_Pete -version=2016.0726.0104.86 -format=Zip -overwrite -outfolder=D:\TeamCity\buildAgent\work\dabe18ca22c2f5c1\Zip -basepat
h=D:\TeamCity\buildAgent\work\dabe18ca22c2f5c1\StageDir\PackageTmp
Octopus Deploy Command Line Tool, version 3.3.18+Branch.master.Sha.d32cf0e4440e5e245f014977288a915c3f267bfd
System.ArgumentException: ‘2016’ is not a valid version string.
Parameter name: version
at NuGet.SemanticVersion.Parse(String version)
at Octopus.Cli.Commands.PackCommand.<.ctor>b__15_9(String v)
at Octopus.Cli.Commands.OptionSet.<>c__DisplayClass15_0.b__0(OptionValueCollection v)
at Octopus.Cli.Commands.OptionSet.ActionOption.OnParseComplete(OptionContext c)
at Octopus.Cli.Commands.Option.Invoke(OptionContext c)
at Octopus.Cli.Commands.OptionSet.ParseValue(String option, OptionContext c)
at Octopus.Cli.Commands.OptionSet.Parse(String argument, OptionContext c)
at Octopus.Cli.Commands.OptionSet.<>c__DisplayClass26_0.b__0(String argument)
at System.Linq.Enumerable.WhereArrayIterator1.MoveNext() at System.Collections.Generic.List
1…ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
at Octopus.Cli.Commands.OptionSet.Parse(IEnumerable1 arguments) at Octopus.Cli.Commands.Options.Parse(IEnumerable
1 arguments)
at Octopus.Cli.Commands.PackCommand.Execute(String[] commandLineArguments)
at Octopus.Cli.Program.Main(String[] args)
Exit code: -3
#============================================================================
Build the zip for the application
#============================================================================
function BuildOctopusZip{
param(
[parameter(Mandatory=$true)] [string]$CheckoutDir,
[parameter(Mandatory=$true)] [string]$TFSSourceDir,
[parameter(Mandatory=$true)] [string]$BuildNbr
)
$DosCommand = "D:\octopus\octo.exe pack -id=" + $TFSSourceDir
$DosCommand += " -version=" + $BuildNbr
$DosCommand += " -format=Zip "
$DosCommand += " -overwrite "
$DosCommand += " -outfolder=" + $CheckoutDir + "\Zip "
$DosCommand += " -basepath=" + $CheckoutDir + "\StageDir\PackageTmp"
write-host $DosCommand
Invoke-Expression $DosCommand
}
BuildOctopusZip “D:\TeamCity\buildAgent\work\dabe18ca22c2f5c1” “JCRL3G_Pete” “2016.0726.0104.86”