Octopus 3.3.1 - vars values in Custom templates are not applied when use "Script from Nuget feed"

I’ve migrated to 3.3.1 from 3.2.24 and can’t understand why the PS script I use does not “see” variables provided.

My PS Script (createNewEnv.ps1) section with Params:
[string]$location = “North Europe”,
[string]$subscrName = “Subscrname#21”,
… some other

When I use “Run a Script” step based on Custom template with all the vars set the same as below, where I switched to “Script file inside a package” option.
Script file name is filled: createNewEnv.ps1 and package Id is the same as in Nuget feed I’ve unpacked before (see below).
In parameters I have all the vars defined as follows (for “location” var):
Variable name: location
Default value: #{location}
Control type: SingleLine text box

But after re-build & deployment in Octopus I got errors saying that PS Script createNewEnv.ps1 can’t binf empty String to the value.
I suppose it’s referring to the envPrefix param missing value.

Previous version of Custom template that worked was the following:
1 Step: I’ve unpacked Nuget feed via WebApp package + Custom extract directorywas set env-dependent path (C:\scripts#{EnvPrefix}\Azure Deployment Scripts New).
2nd Step: PS Script step with source code:
Write-Host “-------------------------------- THIS STEP WILL PERFORM ENVIRONMENT UPGRADE -------------------------”
&“C:\scripts#{EnvPrefix}\Azure Deployment Scripts New\createNewEnv.ps1” -envPrefix #{EnvPrefix} -envType #{EnvType} -location #{location} -tier #{tier} -subscrName #{subscrName} -username #{DeployUser} -password #{DeployUserPassword}

Here all the Vars are passed to the script implicitly.

Hi Alex,

Thanks for getting in touch. This appears to be a bug in variable substitution for scripts contained in a package. We have created a Github Issue here so you can track when this issue is resolved.

You can use the dollar-sign variable syntax as per your first example and it should work. Until the issue is resolved, you just won’t be able to use Octostache variable syntax for scripts within packages.

Hope this helps