Problem when changing installed location through updater - Advanced Installer Community
karlf
Posts: 30
Joined: Tue Nov 01, 2016 7:30 pm

Problem when changing installed location through updater

Hello,

I am running into an issue, it starts when a user installs the base version of my program for Everybody (All users). When an update is available, if they then decide that they want to install for just their user (Only for me) then we run into an error. The error says:

Error writing to file:C:\Users\karls\AppData\Local\Programs\DCI\DigiTrak LWD Bundle\System.Windows.Interactivity.dll Verify that you have access to this directory.

I get the options to retry or canccel. After cancelling, the installation then fails.

The file (being written to) is supposed to go in the app data folder, it is one of the dll's used for my program. However, it seems like it is failing writing the file to that location. The folder itself is not readonly. After I cancel the installation, it is rolled back and the folder is deleted. Is there a way to force that an update must be applied to the same location as it was originally installed, or is there a way to make installing as "only for me" to work after initially installing for all users?

Thanks
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem when changing installed location through updater

Hello,

Please keep in mind that a per-user installation type cannot upgrade a per-machine one and vice versa. So, you should not allow the user to change the installation type during upgrade.

However, to have a better view of your installation scenario, can you please send us to support at advancedinstaller dot com the following files:
1. the AIP (project file) of your old setup project
2. the AIP (project file) of your new setup project (the one which generates the error during upgrade)
3. a verbose log of the failing upgrade installation

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
karlf
Posts: 30
Joined: Tue Nov 01, 2016 7:30 pm

Re: Problem when changing installed location through updater

You say,
So, you should not allow the user to change the installation type during upgrade.
How can I configure my project file so that when the updater finds an update, the same install location is forced?

If there is no answer to that question, I can send in my project files and logs.

Thanks for the help
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem when changing installed location through updater

Hello,

To achieve this you can simply go to "Upgrades" page of your setup project and just make sure the "Use original installation path when upgrading" option is checked.

Let us know if this helped, otherwise please send us the required files and maybe a small step by step test case you perform when upgrading so we can better understand your updates scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
karlf
Posts: 30
Joined: Tue Nov 01, 2016 7:30 pm

Re: Problem when changing installed location through updater

I am not sure if I understand. When I check that option for "Use original installation path when upgrading", when the updater finds an update, in the installer, it still shows the option to install as either "All users" or just the current user. This is the option that I am looking to get rid of, if there is something already installed as either "all users" or the current user. My desired behavior is:

An update to my program is found
That update can detect if the the program it found an update for is installed as "All users" or "current user"
The installer for that update then skips the screen allowing the user to choose who they install as, and instead just installs with the same option that was chosen before

Is this possible? My title for the forum post could have been a bit clearer, this is not about letting the user choose their install location, this is about letting the user choose who to install as (on an update), and the path implicitly changes based off that choice the user has made.

Thanks for all the help so far.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem when changing installed location through updater

Hello, to achieve this you can do an workaround. Here are the steps:

1. In "Dialogs" page:
1.1. right click on "InstallTypeDlg" dialog and select "Show only if.." option, the "Edit Condition" menu will show up.
1.2. in the "Expression" field type "NOT OLDPRODUCTS" and then click "OK"
These steps will make the "InstallTypeDlg" dialog visible only when no previous version of the product is already installed (first time install condition)

2. In "Custom Action" page:
2.1. add a "Preserve Install Type of the old version" custom action with sequence scheduled after "Wizard Dialogs Stage -> Searches" action group
2.2. select the above custom action and while keeping the "Shift" key pressed drag and drop it under "Install Execution Stage -> Searches" action group; this way the custom action will be shared between both execution stages
2.3. select the custom action and in the right pane under "Execution Stage Condition" section click on "Advanced execution scenarios..." hyperlink and select "Skip action in Install Execution Stage if executed in Dialogs Stage" option
2.4. create a "Set Installer Property" custom action with sequence scheduled after "Wizard Dialogs Stage -> Path Resolution" action group and share it under "Install Execution Stage -> Path Resolution" action group too
2.5. configure the above custom action like this:
  • Property: AI_InstallPerUser
    Value: 0
2.6 under "Dialogs Stage Condition" and "Execution Stage Condition" sections check only "Install" option and set "Condition" field to the following expression:

Code: Select all

ALLUSERS = "1"
2.7. select the custom action and in the right pane under "Execution Stage Condition" section click on "Advanced execution scenarios..." hyperlink and select "Skip action in Install Execution Stage if executed in Dialogs Stage" option
2.8. create a "Call Function From Attched Native DLL" custom action with sequence scheduled after "Wizard Dialogs Stage -> Path Resolution" action group (right after the previous added "Set installer property" action) and share it under "Install Execution Stage -> Path Resolution" action group too; this custom action will call the "AI_AuthorSinglePackage" function from our "aicustact.dll" module (this is a DLL file installed by Advanced Installer in its installation folder, i.e. "C:\Program Files (x86)\Caphyon\Advanced Installer 13.7\custact\x86\aicustact.dll")
2.9. configure the above action like this:
  • Attached DLL: C:\Program Files (x86)\Caphyon\Advanced Installer 13.7\custact\x86\aicustact.dll
    Function: AI_AuthorSinglePackage
2.10 under "Dialogs Stage Condition" and "Execution Stage Condition" check only "Install" option for the above action
2.11. select the custom action and in the right pane under "Execution Stage Condition" section click on "Advanced execution scenarios..." hyperlink and select "Skip action in Install Execution Stage if executed in Dialogs Stage" option

Attached you can find a sample created with Advanced Installer 13.7 which implements this workaround. Please test this scenario thoroughly and make sure it works as you expected.
sample.zip
(6.18 KiB) Downloaded 301 times
If there is anything else we can assist you with just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
karlf
Posts: 30
Joined: Tue Nov 01, 2016 7:30 pm

Re: Problem when changing installed location through updater

Thanks for the reply, this seems to be exactly what I'm looking for in terms of the functionality. However, when I try to duplicate the steps, and run a build, I get an error that reads:

Error calling MSI API: 1627 Method: MsiDatabaseImport Table: ControlEvent. Extended Error: 1: 2216 2: C:\SCM\KarlF_KarlF-LT_8749\Software\Projects\LWD\CloudManager\branches\CMAutoUpdates\AdvancedInstaller\BUILD_OUTPUT\DEV\Setup_DigiTrakLWDCloudSuite.msi 3: ControlEvent.idt 4: 31 .

This happens if I try to do a build after making the changes through step 1.2. Do you have any idea what could be causing this?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem when changing installed location through updater

Hello,

Please send us the .AIP (project file) to support at advancedinstaller dot com so we can investigate it.

If you have an AIP project file that can be built successfully and a test case which we can use against the AIP project to achieve that build error please let us know. This will be useful to prevent similar errors in the future.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Problem when changing installed location through updater

Hello Karl,

Thank you for your sent project file. It seems your project "LicenseAgreementDlg" dialog ended up with two duplicated the published events on the [Back] button of your "LicenseAgreementDlg" dialog. To fix this just delete one of the duplicated "Display a specific dialog -> WelcomeDlg" events from "Published Events" list of the [Back] button from "LicenseAgreementDlg".

Most likely you had an existing "Display a specific dialog -> WelcomeDlg" published event on "LicenseAgreementDlg -> Back" button before using the "Show only if..." option on "InstallTypeDlg". After using the "Show only if..." option on "InstallTypeDlg" Advanced Installer automatically added a new "Display a specific dialog -> WelcomeDlg" published event on "LicenseAgreementDlg -> Back" button to link the "WelcomeDlg" dialog with "LicenseAgreementDlg" dialog when the "InstallTypeDlg" won't be displayed. Unfortunately, when we add this dialog link event we don't check to see if there already exists such an event. This is an Advanced Installer limitation.

However, just try to remove one of the duplicated events and test again the workaround scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”