[wix-users] Change installation path of a shared component

Paul Shmakov paul.shmakov at gmail.com
Wed Dec 28 17:43:16 PST 2022


> PS: You caught me on a talkative day. Normally, this depth of answer is reserved for paying customers

Lucky me. Thank you very much, Rob! That was very helpful.

Thanks,
Paul

On Tue, Dec 27, 2022 at 12:02 AM Rob Mensching <rob at firegiant.com> wrote:
>
> > Correct me if I'm wrong:
>
> If "Version B" does not prevent install of "Version A" then you are correct. As long as the existing "Version A" is available and installable it locks the folder down. You could release a new "Version A" that has the updated follow logic to teach it about this new world. Otherwise, you can start planning for a future where "Version A" no is no longer available for new installs in "Version B".
>
> > I mean that we cannot change the installation path because it will also change the key path of the shared component, which seems to be a critical violation according to https://devblogs.microsoft.com/setup/about-shared-components/.
>
> The rules are slightly more flexible when it comes to the directory of a file KeyPath. The Windows Installer will correctly reference count the same Component installed by multiple Products to different directories. That does not break Component Rules.
>
> Your key challenge is that you have a singleton in the Component: the Window Service name.
>
> > Do you mean that if all the products start using the new path, that's a legitimate way to change the path of a shared component?
>
> You can have all the products using a new path and create a new Component. However, the new Component cannot contain any resources that overlap with old Components. So, the filenames do not have to change (because they are in new paths) but other resources probably need name changes. For example, any registry keys in the Component need new keys or names to not overlap with the existing Components. Or, perhaps, just saying, maybe, if you have a Windows Service in the old Component, you'll need to give it a new name in the new Component.
>
> ---
>
> Fundamentally, you could install the Windows Service Component to different directories. I anticipate the service will use the file path from the last installed Component. Then on uninstall, if you remove the second installed, the service will not be removed but the path to the service will be wrong. Then "all you'd need to do" is repair the existing MSI so the service gets the path set correctly. Most people don't like additional the repair scenario... but maybe it doesn't happen often. How often does the user do:
>
> 1. Install Version A
> 2. Install Version B
> 3. Uninstall Version B
> 4. Keep using Version A
>
> Or
>
> 1. Install Version B
> 2. Install Version A
> 3. Uninstall Version A
> 4. Keep using Version B
>
> I'd expect the first scenario is only likely if you have people "testing out and disliking version B". The second scenario seems less likely if version A is not advertised or only advertised as "use Version B instead!".
>
> But you know your scenarios best.
>
>
> PS: You caught me on a talkative day. Normally, this depth of answer is reserved for paying customers: https://www.firegiant.com/services/
>
>
> -----Original Message-----
> From: Paul Shmakov <paul.shmakov at gmail.com>
> Sent: Monday, December 26, 2022 11:06 AM
> To: Rob Mensching <rob at firegiant.com>
> Cc: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Subject: Re: [wix-users] Change installation path of a shared component
>
> Thank you for the prompt response, Rob!
>
> > Follow the old location if it exists (ComponentSearch?) and install to new location if old location does not exist.
>
> Correct me if I'm wrong:
> 1. It works if you install a new version of product A on a machine where an old version of product B is installed. A's installer executes ComponentSearch to determine the correct path.
> 2. It does not work if you install an old version of B on a machine with a new version of A. B will install a second copy, at the old location.
>
> I wonder if there is some clever trick that also solves problem #2. In our case both scenarios are possible.
>
> > No. Path of the Component can change. Shape of the Component cannot.
>
> Do you mean that if all the products start using the new path, that's a legitimate way to change the path of a shared component?
> I mean that we cannot change the installation path because it will also change the key path of the shared component, which seems to be a critical violation according to https://devblogs.microsoft.com/setup/about-shared-components/.
>
> Thanks!
>
> On Mon, Dec 26, 2022 at 9:41 PM Rob Mensching <rob at firegiant.com> wrote:
> >
> > > There is a strong desire to change the installation path of the component to %ProgramFiles%\BAR Company\BAR Component. I.e. the company name changes.
> >
> > Follow the old location if it exists (ComponentSearch?) and install to new location if old location does not exist.
> >
> > > My understanding is that we cannot just change the installation path of the component, because it will break the MSI rule that the component's ID and Path must not change.
> >
> > No. Path of the Component can change. Shape of the Component cannot.
> >
> > > Having two copies of the service does not work either - we can have only a single Windows service with the predefined name.
> >
> > True. Windows limitation.
> >
> >
> >
> > -----Original Message-----
> > From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of
> > Paul Shmakov via wix-users
> > Sent: Monday, December 26, 2022 6:31 AM
> > To: wix-users at lists.wixtoolset.org
> > Cc: Paul Shmakov <paul.shmakov at gmail.com>
> > Subject: [wix-users] Change installation path of a shared component
> >
> > Hello everyone!
> >
> > What would be the right way to change an installation path of a shared component?
> >
> > AS IS
> > There is a shared component which is a Windows service (MyServiceName) installed into %ProgramFiles%\FOO Company\FOO Component.
> > There can be only a single instance of the service on a machine, with the predefined name (MyServiceName), as it controls a device.
> >
> > The component is included into 3 products (A, B, and C). There are lots of old released versions of these products. Different combinations of the products can be installed on the same machine: new A and new B; old A and new B; new A and old B; etc.
> >
> > The service is packaged as a WIX library.
> >     <DirectoryRef Id="COMP_INSTALLLOCATION">
> >       <Component Id="MySharedComponentId" Guid="12345" >
> >         <File Id="Service.exe" Name="Service.exe" KeyPath="yes"
> > Checksum="yes" />
> >         <ServiceInstall Name="MyServiceName" ErrorControl="normal"
> > Interactive="no" Start="demand" Type="ownProcess" Vital="yes" />
> >         <ServiceControl Id="ServiceControl" Name="MyServiceName"
> > Stop="both" Remove="uninstall" />
> >       </Component>
> >     </DirectoryRef>
> >
> > TO BE
> > There is a strong desire to change the installation path of the component to %ProgramFiles%\BAR Company\BAR Component. I.e. the company name changes.
> >
> > New versions of the products will be released with the updated installation path. However, there are still lots of older versions out there. We want to preserve compatibility, so a new version of product A should work correctly with an old version of product B - there still needs to be a single Windows service with the same old name.
> >
> > My understanding is that we cannot just change the installation path of the component, because it will break the MSI rule that the component's ID and Path must not change.
> > Having two copies of the service does not work either - we can have only a single Windows service with the predefined name.
> >
> > I'd really appreciate it if you could share your ideas on possible solutions for this case.
> >
> > Thanks,
> > Paul
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/


More information about the wix-users mailing list