Pergunta

I have several steps to figure out this problem and I do't know what else to do. My end goal is to check my "app.exe" file version. when I run it on server manually both script versions work. But when Octopus runs both versions fail with different errors

Version 1:

  $file = "C:\Octopus\Applications\AppStartUp\38.2.19.0\app.exe"
  $fileVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($file).FileVersion

I get the error:

return [System.Diagnostics.FileVersionInfo]::GetVersionInfo <<<< ($file).    FileVersion
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : DotNetMethodException

Version 2:

$file = "C:\Octopus\Applications\AppStartUp\38.2.19.0\app.exe"
(Get-Command "$file").FileVersionInfo.Fileversion

Error Message

Export-ModuleMember : The Export-ModuleMember cmdlet can only be called from in side a module. At C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\deployment\clickOnceLib.ps1:35 char:20
    + Export-ModuleMember <<<<  -function * -alias *
    + CategoryInfo          : PermissionDenied: (:) [Export-ModuleMember], InvalidOperationException
    + FullyQualifiedErrorId : Modules_CanOnlyExecuteExportModuleMemberInsideAModule,Microsoft.PowerShell.Commands.ExportModuleMemberCommand 
Get-Command : The term 'C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\ESG.CSIS.StartUp.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\deployment\clickOnceLib.ps1:32 char:24
    +     return (Get-Command <<<<  "$file").FileVersionInfo.Fileversion
    + CategoryInfo          : ObjectNotFound: (C:\Octopus\Appl...SIS.StartUp.exe:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Any Insite to these messages and why it happens only when running in octopus would be great.

Foi útil?

Solução

It looks like your script can't access the file, or it doesn't exist. Check to make sure C:\Octopus\Applications\CSIS_DEV\ESG.CSIS.StartUp\38.2.19.0\ESG.CSIS.StartUp.exe exists and is accessible to the user the tentacle runs under (use windows effective permissions).

Also make sure it's there by the time the script runs, you haven't mentioned whether this is a seperate step, PreDeploy.ps1, Deploy.ps1 or PostDeploy.ps1 script

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top