Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

Powershell build fails

I'm migrating our build process to powershell and taking advantage of AI 16 COM automation.

Unfortunately, I'm having an issue with this new setup: the Rebuild() method fails:

Code: Select all

Checking builds status
Build required.
[ DefaultBuild ]
Creating MSI database (en)
Writing Summary Information
Creating MSI database (fr)
Writing Summary Information
Creating MSI database (de)
Writing Summary Information
Building package: 
W:\WINEUR\Installers\WinEUR MSI\Setup Files\WinEUR_v4.3.125.0.msi
Prepare build
Preparing files
Creating CAB file(s)
Computing files hashes
Creating transforms for additional languages
Creating MSI database
Inserting CAB file(s) into MSI
 
 ERROR:
Error calling MSI API: 161 Method: MsiRecordSetStream Table: _Streams.
 
At W:\wineur\bat\wineur_setup_create.ps1:307 char:13
+             $projectInstance64.Rebuild()
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
The error doesn't seem to always occure and it doesn't occure when I'm using the IDE:

Code: Select all

Checking builds status
Build required.

[ DefaultBuild ]
Creating MSI database (en)
Writing Summary Information
Creating MSI database (fr)
Writing Summary Information
Creating MSI database (de)
Writing Summary Information
Building package: 
W:\wineur\Installers\WinEUR MSI\Setup Files\WinEUR_v4.3.125.0.msi
Prepare build
Preparing files
Creating CAB file(s)
Computing files hashes
Creating transforms for additional languages
Creating MSI database
Inserting CAB file(s) into MSI
Writing Summary Information
Validating MSI
 
Total build time: 9 min 17 sec.
 
Build finished successfully.
I'm using version 16.2
(edit: The issue is similar in version 16.2 and 16.1)
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Powershell build fails

Hello,
The error doesn't seem to always occure and it doesn't occure when I'm using the IDE:
By this, do you mean that the Rebuild() method never fails when the script is run from within the IDE, but it fails when you launch the .ps1 file?

If that is the case, could you please give me some more details about what you want to automate? I have just done a little test using this scenario but everything worked as expected.

Could you please forward me the project that you are trying to rebuild by e-mail at support at advancedinstaller dot com so I can investigate its settings?

Additionally, could you please also forward me the PowerShell script used to build the project? Also, how often does this issue reproduce?

As a last note, could you please check if there is enough space left on the partition where the project is built?

Looking forward to hearing from you.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

Re: Powershell build fails

By this, do you mean that the Rebuild() method never fails when the script is run from within the IDE, but it fails when you launch the .ps1 file?
Yes.
If that is the case, could you please give me some more details about what you want to automate? I have just done a little test using this scenario but everything worked as expected.
Sure: the old script (which never failed) was running the following command file (/execute):

Code: Select all

;aic
SetVersion 4.3.93
ResetSig
Save
reBuild
The new powershell script (which fails) is:

Code: Select all

            $AdvInstaller = New-Object -ComObject Advancedinstaller
            write-Host "Loading project $AIProjectSource"
            $projectInstance64 = $AdvInstaller.LoadProject($AIProjectSource)
            write-Host "Setting version to $Version"
            $projectInstance64.ProductDetails.Version = $Version
            write-Host "Rebuilding installer"
            $projectInstance64.Rebuild()
            write-Host "All done."
Additionally, could you please also forward me the PowerShell script used to build the project?

Code: Select all

param(
    [string] $AIProjectSource = "W:\WINEUR\Installers\WinEUR MSI\WinEUR.aip"
)


if (!(Test-Path $AIProjectSource -PathType Leaf) -and ($AIProjectSource -match ".*(\.aip)$"))
{
   Write-Host "Project file $AIProjectSource not found" -ForegroundColor Red
}
else
{
    Write-Host "Using project $AIProjectSource" -ForegroundColor Cyan
    $versionfile="S:\WinEUR.version\ProgInfo.INC"
    $version = [regex]::new("(?<ver>\d+,\d+,\d+,\d+)", 3).Match((Get-Content -Path $versionfile) ).Value -replace ",","."
    if ($version -notmatch "^\d+\.\d+\.\d+\.\d+$")
    {
       Write-Host "Invalid version extracted from $versionfile : '$version'" -ForegroundColor Red
    }
    else
    {
        Write-Host "Version extracted from $versionfile : '$version'" -ForegroundColor Cyan
        $AdvInstaller = New-Object -ComObject Advancedinstaller
        write-Host "Loading project $AIProjectSource"
        $projectInstance64 = $AdvInstaller.LoadProject($AIProjectSource)
        write-Host "Setting version"
        $projectInstance64.ProductDetails.Version = $Version
        write-Host "Rebuilding installer"
        $projectInstance64.Rebuild()
        write-Host "All done."
    }
}
Also, how often does this issue reproduce?
It's hard to say but not very often: I worked on that script for several hours todaysince it takes 10 minutes for a build to complete, I didn't let it run to completion very often: only 6 times. Of these 6 attempts, three ended with the reported error (usually after several minutes, not 100% sure how long exactly). The first run worked fine, then the next three failed. At that point, I tried it from the IDE (and saved the result) and it worked.

After that, 2 additional runs (from the powershell script) completed sucessfully.
Could you please forward me the project that you are trying to rebuild by e-mail at support at advancedinstaller dot com so I can investigate its settings?
Sure, will do.
As a last note, could you please check if there is enough space left on the partition where the project is built?
Definitly plenty of space, yes: it's my dev machine with ~1.4 TB available on that partition.
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Powershell build fails

Hello Stephane,

First of all, thank you for the provided .AIP file.

I have investigate the sent .AIP file and run some additional tests, but unfortunately I was not able to reproduce the issue on my end.

In order for me to further investigate this, could you please also send me a download link for the built setup?

Looking forward to hearing from you.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

Re: Powershell build fails

Hello,

First, some good news: it seems that the build failure is not occuring anymore, at least, it didn't occure in my recent tests.

Bad new, though: I can't provide you with a link to the installer source.


Also, I'm not going to be available in the comming week so I guess I'll have to tackle hat issue again when I'm back.

Thank you for investigating, I will post a reply when I come back if the issue reapears.
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Powershell build fails

Hello Stephane,

Thank you for your followup on this.

I am glad the issue does not occur anymore.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”