if I load the AppDeployToolkitMain.ps1 to create a new deployment I get an error in the Line 11262 - 11264 “It is not possible to call a method for an expression that has the value NULL.” and I don’t see where the error is.
Does someone have the same mistake?
Are you using the latest version of the toolkit?
Anytime I’ve encountered this error, it’s because in one way or another, I’ve tried to run the Deploy-Application.ps1 script in such a way that the main script (AppDeployToolkitMain.ps1) is missing or can’t be found.
Did you comment out any of the $app variables inside Deploy-Application.ps1 ? You can leave them empty but you cant delete them.
@luki yes I use 3.8.3
No, the interesting thing is that I can install everything from Deployapplication.ps1, but when I try to load Deployapplicationmain.ps1 from Powershell ISE so that I can use the features in Deployapplication.ps1 this error occurs.
i meain this section in the main.ps1:
Sanitize the application details, as they can cause issues in the script
[string]$appVendor = (Remove-InvalidFileNameChars -Name ($appVendor.Trim()))
[string]$appName = (Remove-InvalidFileNameChars -Name ($appName.Trim()))
[string]$appVersion = (Remove-InvalidFileNameChars -Name ($appVersion.Trim()))
[string]$appArch = (Remove-InvalidFileNameChars -Name ($appArch.Trim()))
[string]$appLang = (Remove-InvalidFileNameChars -Name ($appLang.Trim()))
[string]$appRevision = (Remove-InvalidFileNameChars -Name ($appRevision.Trim()))
The error only occurs for $appArch, $appLang and $appRevision.
It occurs because one of the variable is $null not a [string] therefore it does not have a Trim() method.
Since you can’t call methods on $null, it throws an error. The bigger question is: why is it undefined?
Deploy-Application.ps1 defines all those variables so they are strings when Main.ps1 gets to them.