Executing PreDeploy.ps1 failed

PreDeploy script is failing whatever you put inside.

Deploying package: C:\Octopus\Packages\xxxxxxxx.1.0.354-master.nupkg
June 15th 2018 19:00:32Verbose
Extracting package to: E:\Octopus\Work\20180615160031-47235-222\staging
June 15th 2018 19:00:33Verbose
Extracted 221 files
June 15th 2018 19:00:33Verbose
Executing ‘E:\Octopus\Work\20180615160031-47235-222\staging\Octopus.Action.CustomScripts.PreDeploy.ps1’
June 15th 2018 19:00:34Verbose
Name Value
June 15th 2018 19:00:34Verbose


June 15th 2018 19:00:34Verbose
PSVersion 5.1.14409.1012
June 15th 2018 19:00:34Verbose
PSEdition Desktop
June 15th 2018 19:00:34Verbose
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
June 15th 2018 19:00:34Verbose
BuildVersion 10.0.14409.1012
June 15th 2018 19:00:34Verbose
CLRVersion 4.0.30319.42000
June 15th 2018 19:00:34Verbose
WSManStackVersion 3.0
June 15th 2018 19:00:34Verbose
PSRemotingProtocolVersion 2.3
June 15th 2018 19:00:34Verbose
SerializationVersion 1.1.0.1
June 15th 2018 19:00:34Verbose
PowerShell Environment Information:
June 15th 2018 19:00:34Verbose
OperatingSystem: Microsoft Windows NT 6.3.9600.0
June 15th 2018 19:00:34Verbose
OsBitVersion: x64
June 15th 2018 19:00:34Verbose
Is64BitProcess: True
June 15th 2018 19:00:34Verbose
CurrentUser: NT AUTHORITY\SYSTEM
June 15th 2018 19:00:34Verbose
MachineName: DC-TEAMCITY
June 15th 2018 19:00:34Verbose
ProcessorCount: 4
June 15th 2018 19:00:34Verbose
CurrentDirectory: E:\Octopus\Work\20180615160031-47235-222\staging
June 15th 2018 19:00:34Verbose
CurrentLocation: E:\Octopus\Work\20180615160031-47235-222\staging
June 15th 2018 19:00:34Verbose
TempDirectory: C:\Windows\TEMP\
June 15th 2018 19:00:34Verbose
HostProcessName: powershell
June 15th 2018 19:00:35Verbose
TotalPhysicalMemory: 14679604 KB
June 15th 2018 19:00:35Verbose
AvailablePhysicalMemory: 7084452 KB
June 15th 2018 19:00:35Info
Attempt 1 of 5 failed: Could not load file or assembly ‘System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.
June 15th 2018 19:00:35Info
Waiting for 5 seconds before retrying…
June 15th 2018 19:00:40Info
Retrying…
June 15th 2018 19:00:40Info
Attempt 2 of 5 failed: Could not load file or assembly ‘System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.
June 15th 2018 19:00:40Info
Waiting for 5 seconds before retrying…
June 15th 2018 19:00:45Info
Retrying…
June 15th 2018 19:00:45Info
Attempt 3 of 5 failed: Could not load file or assembly ‘System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.
June 15th 2018 19:00:45Info
Waiting for 5 seconds before retrying…
June 15th 2018 19:00:50Info
Retrying…
June 15th 2018 19:00:50Info
Attempt 4 of 5 failed: Could not load file or assembly ‘System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.
June 15th 2018 19:00:50Info
Waiting for 5 seconds before retrying…
June 15th 2018 19:00:55Info
Retrying…
June 15th 2018 19:00:55Error
Get-AzureRmEnvironment : Could not load file or assembly ‘System.Net.Http,
June 15th 2018 19:00:55Error
Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of
June 15th 2018 19:00:55Error
its dependencies. The system cannot find the file specified.
June 15th 2018 19:00:55Error
At
June 15th 2018 19:00:55Error
E:\Octopus\Work\20180615160031-47235-222\staging\Octopus.AzureContext.ps1:61
June 15th 2018 19:00:55Error
char:29
June 15th 2018 19:00:55Error

  • … reEnvironment = Get-AzureRmEnvironment -Name $OctopusAzureEnvironment
    June 15th 2018 19:00:55Error
  •                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    

June 15th 2018 19:00:55Error
+ CategoryInfo : NotSpecified: (:slight_smile: [Get-AzureRmEnvironment], File
June 15th 2018 19:00:55Error
NotFoundException
June 15th 2018 19:00:55Error
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.Azure.
June 15th 2018 19:00:55Error
Commands.Profile.GetAzureRMEnvironmentCommand
June 15th 2018 19:00:55Error

June 15th 2018 19:00:55Error
PreDeploy script returned non-zero exit code: 1
June 15th 2018 19:00:55Error
Running rollback conventions…
June 15th 2018 19:00:55Error
PreDeploy script returned non-zero exit code: 1
June 15th 2018 19:00:55Verbose
Process C:\Windows\system32\WindowsPowershell\v1.0\PowerShell.exe in E:\Octopus\Work\20180615160031-47235-222 exited with code 1
June 15th 2018 19:00:55Verbose
Updating manifest with output variables
June 15th 2018 19:00:55Verbose
Updating manifest with action evaluated variables
June 15th 2018 19:00:55Fatal
The remote script failed with exit code 1
June 15th 2018 19:00:55Fatal
The action Offers Deploy on the Octopus Server failed

Hi Constantine,

Thank you for getting in touch.

Could you please tell me what version of Octopus your are currently using?

Also, could you let me know what step it is you’re using and what your pre-deploy script is?

Thank you and best regards,
Henrik

Hi Henrik,

We are using Octopus v2018.6.3. Actually our deploly script sets appsettings for web application.
Issue happens independently to what you are put in pre/post deploy script. (f.e. Write-Host “Hello!”)

We made investigation and issue with lost assembly are solved but we got another one with azure modules bootstrapping so we created an issue for azure-powershell in github -
Azure powershell issue link.
Seems it related to AzureRM.Profile module and octopus bootstrapping modules before running scripts.

Thank you and best regards,
Constantine

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.