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

[Powershell] project changes are saved even if IAdvinstProject.Save() has not been called

Using AI version 16.2.

I'm using the following powershell code to build my installer:

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."
After running this command, the project file ($AIProjectSource) is updated with the latest version ($Version) even $projectInstance64.Save() has never been called. Other changes are propagated as well (for instance, the version of advanced installer that is "burned" into the aip is updated to the version installed on the machine that does the build).
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: [Powershell] project changes are saved even if IAdvinstProject.Save() has not been called

Hello,
the project file ($AIProjectSource) is updated with the latest version ($Version) even $projectInstance64.Save() has never been called.
The version is updated in your .AIP file, because you are rebuilding the whole project. The build process means save+build. Additionally, the rebuild process means save+rebuild.
Other changes are propagated as well (for instance, the version of advanced installer that is "burned" into the aip is updated to the version installed on the machine that does the build).
I am not quite sure I understand what you mean here. Could you please give me some more details (maybe exemplify)? By version, do you mean version, as in 16.1 and 16.2, or you mean Professional, Enterprise, etc.? If the first one is the case, then this is normal as well. If your project is created with, for instance, 16.1 and you have only 16.2 installed, then yes, the project will be updated to 16.2 since it is built using Advanced Installer 16.2.

Hope this helps.

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] project changes are saved even if IAdvinstProject.Save() has not been called

Thank you for your answer.
The version is updated in your .AIP file, because you are rebuilding the whole project. The build process means save+build. Additionally, the rebuild process means save+rebuild.
That is a real shame and should be made explicit in the documentation.
I am not quite sure I understand what you mean here. Could you please give me some more details (maybe exemplify)? By version, do you mean version, as in 16.1 and 16.2, or you mean Professional, Enterprise, etc.? If the first one is the case, then this is normal as well. If your project is created with, for instance, 16.1 and you have only 16.2 installed, then yes, the project will be updated to 16.2 since it is built using Advanced Installer 16.2.
I was writing about the version number of Advanced installer that gets written in the .AIP file in the "version" attribute of the "DOCUMENT" element but you basically answered this point already.
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: [Powershell] project changes are saved even if IAdvinstProject.Save() has not been called

Hello,
Thank you for your answer.
You are always welcome.
That is a real shame and should be made explicit in the documentation.
Thank you for your feedback on this. I have forwarded this to our Technical Writing team and hopefully the article will be updated soon.

I apologize for the inconvenience.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: [Powershell] project changes are saved even if IAdvinstProject.Save() has not been called

Hello,

Actually, after discussing with the developer in charge for this, we have decided to remove the automatic save when the project is built or rebuilt.

Thank you once again for the feedback.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: [Powershell] project changes are saved even if IAdvinstProject.Save() has not been called

Hello,

This improvement has been added in version 16.3 of Advanced Installer released on September 4th, 2019.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MGS
Posts: 128
Joined: Tue Oct 04, 2022 9:52 am

Re: [Powershell] project changes are saved even if IAdvinstProject.Save() has not been called

Hi there,

I ran into this problem when using the new Powershell syntax:

Code: Select all

Set-Location 'C:\PathToAIProject\'
$advinst = New-Object -ComObject AdvancedInstaller
$ai_path = Join-Path -Path (Get-Location) -ChildPath "XRangeEye.aip"
$project = $advinst.LoadProject($ai_path)
$project.ProductDetails.Name = "TestProduct"
$project.Rebuild($build_config)
Afterwards the change (the product name) is persisted in the project without calling $project.Save().

All the best,
Johannes
Liviu
Posts: 1419
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: [Powershell] project changes are saved even if IAdvinstProject.Save() has not been called

Hello Johannes,

I have tested this with a sample project and I can indeed confirm the behavior.

I have forwarded this to our development team and hopefully this will be fixed in a future version of Advanced Installer. As soon as the fix will be released we will notify you.

Thank you for bringing this to our attention!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: [Powershell] project changes are saved even if IAdvinstProject.Save() has not been called

Hello,

This has been fixed in version 20.5 of Advanced Installer, released on March 30th, 2023.

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

Return to “Common Problems”