Hi,
We are not able to access a variable in the PowerShell script if the variable name contains dot (.) in it. For example in the variable section we have defined these variables:
Thanks for getting in touch! There are a couple of ways this can work, it looks like you are close.
As per the following documentation page, you should be able to reference your Source.Directory variable in the following ways.
For a project variable named Source.Directory
${SourceDirectory} #If your project variable has a stop in it you should remove it when calling this way.
$OctopusParameters["Source.Directory"] #You do not need to remove the stop if calling it like this.
#{Source.Directory} #Using the # syntax will let you call the variable with the stop.
Let me know if this helps clear things up for you.
Thanks for your response.
$OctopusParameters[“Source.Directory”] - this solution is working for me.
I also tried #{Source.Directory} but when such variable is used in combination with other values its not working like for e.g.
#{Source.Directory} + " \ *" #e.g. c:\test\source \ *
but following is working:
$OctopusParameters[“Source.Directory”] + " \ *"
shared this analysis for that it can be helpful for someone else. I am good as one of the two provided solution is working for me.