InvalidType: Cannot find type [System.Collections.Generic.List[Amazon.ECS.Model.ContainerDefinition]]: verify that the assembly containing this type is loaded.
My docker container has powershell version 4.1.2
What assembly do I need to add to my docker container here to get the script working? Or what other worker I can use for this script to work?
Thanks for reaching out and providing all that info!
From the error message provided it seems that the ‘Amazon.ECS.Model.ContainerDefinition’ isn’t known by Powershell. Could you please confirm that the AWS SDK is installed in the container you are running the script from?
Feel free to let me know if you have any questions or if you run into any issues!
Although PowerShell 3.0 and later releases typically load modules into your PowerShell session the first time you run a cmdlet in the module, the AWSPowerShell.NetCore module is too large to support this functionality. So must instead explicitly load the AWSPowerShell.NetCore Core module into your PowerShell session by running the following command.
Import-Module AWSPowerShell.NetCore
In above Octopus docker file I added below
ADD Profile.ps1 C:\Windows\System32\WindowsPowerShell\v1.0
where profile.ps1 has
C:>type Profile.ps1
Import-Module AWSPowerShell.NetCore
After adding profile to import AWSPowerShell.NetCore module, script is working.