[wix-users] How can I conditionally overwrite DLLs during WIX installation of different packages?

Edwin Castro egcastr at gmail.com
Thu Feb 7 13:39:11 PST 2019


I'd like to emphasize the point on using the versioned file as the key
path. In general, you always want your key path to be versioned resource,
like a DLL or EXE.

If your key path is a registry value, then the Windows Installer cannot
tell when a new version of the component getting installed because the
registry value doesn't have a version. The only thing the Windows Installer
can do is determine whether the registry value exists or not. It it already
exists, then the component is not reinstalled (without changing
REINSTALLMODE).

Your component should look closer to this:

<Component Id="HWAPIDLL" Guid="18a81c9e-726b-4867-ae07-5bf357bc8188"
Shared="yes" Win64="yes" >
        <File Id="testdll" Name="test.dll" Source="Drivers\SHA2\x64\test.dll"
KeyPath="yes"/>
</Component>

If the registry value is helpful for other purposes, then

<Component Id="HWAPIDLL" Guid="18a81c9e-726b-4867-ae07-5bf357bc8188"
Shared="yes" Win64="yes" >
        <File Id="testdll" Name="test.dll" Source="Drivers\SHA2\x64\test.dll"
KeyPath="yes"/>
        <RegistryValue Root="HKLM" Key="Software\Intel\Intel(R) System
Scope Tool" Name="installed" Type="integer" Value="1"/>
</Component>

Of course, if you already have previous versions already, then you'll need
to do a lot of testing to make sure they all get upgraded correctly. If you
don't have previous versions released, then you still want to do a lot of
testing to make sure future upgrades work correctly.

NOTE: I changed Root to HKLM on the RegistryValue above. You said this was
a driver. I don't think drivers cannot be installed per-user so it makes
little sense to check the user's registry hive to see if the driver is
"installed". Seems to me that should be better tracked in HKLM.

--
Edwin G. Castro


On Wed, Feb 6, 2019 at 10:20 PM Hoover, Jacob via wix-users <
wix-users at lists.wixtoolset.org> wrote:

> Sounds like you should try a bare minimum authoring first, as you haven’t
> defined all the scheduling authoring nor a justification for it.
>
> Windows installer should do exactly what you want without all the
> conditions/custom actions/properties as long as you maintain the version
> info on your dll (just let it be the key path).
>
> On Feb 7, 2019, at 12:02 AM, Sebastian, ChinchuX <
> chinchux.sebastian at intel.com<mailto:chinchux.sebastian at intel.com>> wrote:
>
> Blair Murri,
> May be I am. I need to update the latest version of DLLs across multiple
> packages like our old installer doing.
>
> Jacob,
> If the dll in “Drivers\SHA2\x64\test.dll” is found successfully the
> DLLINSTALLED property will be set
>
> Thanks & Regards,
> Chinchu
>
> From: Blair Murri [mailto:osito at live.com]
> Sent: Thursday, February 7, 2019 11:07 AM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org<mailto:
> wix-users at lists.wixtoolset.org>>; Hoover, Jacob <
> jacob.hoover at greenheck.com<mailto:jacob.hoover at greenheck.com>>
> Cc: Sebastian, ChinchuX <chinchux.sebastian at intel.com<mailto:
> chinchux.sebastian at intel.com>>
> Subject: Re: [wix-users] How can I conditionally overwrite DLLs during WIX
> installation of different packages?
>
> I'm with Jacob. You seem to be working cross-purposes from the way Windows
> Installer was designed (which is to help insure the latest versions are
> installed and to leave clean uninstalls).
> Get Outlook for Android<https://aka.ms/ghei36>
>
> ________________________________
> From: Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:
> Jacob.Hoover at greenheck.com>>
> Sent: Wednesday, February 6, 2019 9:13:49 AM
> To: WiX Toolset Users Mailing List; Blair Murri
> Cc: Sebastian, ChinchuX
> Subject: RE: [wix-users] How can I conditionally overwrite DLLs during WIX
> installation of different packages?
>
> What the justification for the Condition on your component? How is the
> DLLINSTALLED property being set?
>
> My gut feeling is you added a bunch of authoring you don't need, as a bare
> minimum Component with a file as the keypath should "just work" and Windows
> Installer should do the right thing.
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
> Of Sebastian, ChinchuX via wix-users
> Sent: Tuesday, February 5, 2019 10:14 PM
> To: Blair Murri <osito at live.com<mailto:osito at live.com>>; WiX Toolset
> Users Mailing List <wix-users at lists.wixtoolset.org<mailto:
> wix-users at lists.wixtoolset.org>>
> Cc: Sebastian, ChinchuX <chinchux.sebastian at intel.com<mailto:
> chinchux.sebastian at intel.com>>
> Subject: Re: [wix-users] How can I conditionally overwrite DLLs during WIX
> installation of different packages?
>
> Do you ever explicitly set REINSTALLMODE?
> No
>
> What values do you set on <MajorUpgrade/>?
> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is
> already installed." />
>
> Do any of your components contain more than one file?
> Yes
>
> Do any of your components containing a file have its KeyPath set to
> anything else (either on the Component itself or via any child of that
> component)?
> My DLL component is defined like this:
> <Property Id="DLLINSTALLED" >
>       <DirectorySearch Id="DLLVersion" Path="[HWAPIDIR]">
>         <FileSearch Name="test.dll" MinVersion="10.0.0"/>
>       </DirectorySearch>
> </Property>
>
> <Component Id="HWAPIDLL" Guid="18a81c9e-726b-4867-ae07-5bf357bc8188"
> Shared="yes" Win64="yes" >
>         <Condition><![CDATA[NOT DLLINSTALLED]]></Condition>
>         <File Id="testdll" Name="test.dll"
> Source="Drivers\SHA2\x64\test.dll" />
>         <RemoveFolder Id="HWAPIDLL"  Directory="HWAPIDIR" On="uninstall"/>
>         <RegistryValue Root="HKCU" Key="Software\Intel\Intel(R) System
> Scope Tool" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
> </Component>
>
> Are you doing either Small Updates or Patching, or only Major Upgrades?
> Both small updates and Major upgrades are doing
>
> How do you set your ComponentCodes? Are you doing Harvesting in your build?
> No I am not harvesting in build
>
> Do any of your MSIs contain Merge Modules?
> No
>
> Thanks & Regards,
> Chinchu
>
> From: Blair Murri [mailto:osito at live.com]
> Sent: Tuesday, February 5, 2019 11:54 PM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org<mailto:
> wix-users at lists.wixtoolset.org>>; Sebastian, ChinchuX <
> chinchux.sebastian at intel.com<mailto:chinchux.sebastian at intel.com>>
> Subject: Re: [wix-users] How can I conditionally overwrite DLLs during WIX
> installation of different packages?
>
> Do you ever explicitly set REINSTALLMODE?
> What values do you set on <MajorUpgrade/>?
> Do any of your components contain more than one file?
> Do any of your components containing a file have its KeyPath set to
> anything else (either on the Component itself or via any child of that
> component)?
> Are you doing either Small Updates or Patching, or only Major Upgrades?
> How do you set your ComponentCodes? Are you doing Harvesting in your build?
> Do any of your MSIs contain Merge Modules?
> Certain combinations of the answers to the above questions can cause the
> symptoms you report.
> Get Outlook for Android<https://aka.ms/ghei36>
>
> ________________________________
> From: Sebastian, ChinchuX <chinchux.sebastian at intel.com<mailto:
> chinchux.sebastian at intel.com<mailto:chinchux.sebastian at intel.com%
> 3cmailto:chinchux.sebastian at intel.com>>>
> Sent: Tuesday, February 5, 2019 4:51:00 AM
> To: Blair Murri; WiX Toolset Users Mailing List
> Subject: RE: [wix-users] How can I conditionally overwrite DLLs during WIX
> installation of different packages?
>
> Thanks Blair Murri for the answer.
> The reason Why I kept the file as permanent is I need to upgrade the file,
> if the latest version is available.
> If we did not keep file as permanent, version upgrade was not happening,
> highest version of file was removing at the time of major and minor upgrade
> of packages.
>
> Could you please suggest any method to keep files as shared and not remove
> the files at the time of uninstallation/upgrade of packages depending upon
> any checking condition.
>
>
> Thanks & Regards,
> Chinchu
>
> From: Blair Murri [mailto:osito at live.com]
> Sent: Monday, February 4, 2019 5:16 PM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org<mailto:
> wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org%
> 3cmailto:wix-users at lists.wixtoolset.org>>>
> Cc: Sebastian, ChinchuX <chinchux.sebastian at intel.com<mailto:
> chinchux.sebastian at intel.com<mailto:chinchux.sebastian at intel.com%
> 3cmailto:chinchux.sebastian at intel.com>>>
> Subject: Re: [wix-users] How can I conditionally overwrite DLLs during WIX
> installation of different packages?
>
> That's what permanent means. The component can be serviced (you can update
> it) but it won't ever be removed.
> The right way to deal with a file that is shared across various packages
> (and is installed to the same location) is to ensure that the component
> GUID matches for that file in every package (and don't set permanent). That
> way, no matter the order of installations, upgrades/updates, and removals,
> the file will always be there whenever any of the packages are installed
> and removed when the last one is removed.
> The only other attribute to use for that component is to additionally add
> SharedDllRefCount, but that is only to be used when the same file is also
> installed by non-MSI installers that use the SharedDlls registration scheme
> that predates MSI itself.
> Get Outlook for Android<https://aka.ms/ghei36>
>
> ________________________________
> From: wix-users <wix-users-bounces at lists.wixtoolset.org<mailto:
> wix-users-bounces at lists.wixtoolset.org<mailto:
> wix-users-bounces at lists.wixtoolset.org%
> 3cmailto:wix-users-bounces at lists.wixtoolset.org>>> on behalf of
> Sebastian, ChinchuX via wix-users <wix-users at lists.wixtoolset.org<mailto:
> wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org%
> 3cmailto:wix-users at lists.wixtoolset.org>>>
> Sent: Sunday, February 3, 2019 9:39:44 PM
> To: WiX Toolset Users Mailing List
> Cc: Sebastian, ChinchuX
> Subject: Re: [wix-users] How can I conditionally overwrite DLLs during WIX
> installation of different packages?
>
> Hi Christopher/Dexter,
>
> Thanks for the update.
>
> I had tried the method suggested by Walter Dexter and got the result as
> well.
> But I defined the component which installs DLL as permanent to overcome
> the uninstallation and upgrade of packages because that DLL might be used
> by some other packages as well.
> The problem which I am facing now is, the permanent component is not
> deleting after the uninstallation of all packages.
>
> Is there any method to solve the issue, like we can check any condition
> which works only on uninstallation of packages or Any method which can able
> to check the status of a file existence at the time of only uninstallation
> of packages and change the status of components from permanent to temporary?
>
> Thanks in advance.
>
> Thanks & Regards,
> Chinchu
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
> Of Christopher Painter via wix-users
> Sent: Saturday, February 2, 2019 6:55 PM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org<mailto:
> wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org%
> 3cmailto:wix-users at lists.wixtoolset.org>>>
> Cc: Christopher Painter <chrpai at iswix.com<mailto:chrpai at iswix.com<mailto:
> chrpai at iswix.com%3cmailto:chrpai at iswix.com>>>
> Subject: Re: [wix-users] How can I conditionally overwrite DLLs during WIX
> installation of different packages?
>
> What language is your application written?  Are the DLL's "registered"?
>  Does your language have some form of  late binding?
>
> The only tolerable way I can see out of this sticky mess would be
> something like:
>
> 1) Install these shared dll's to a folder structure that allows all of
> them to be installed side by side in unique subfolders.  This is because
> they don't follow the component rules and are really distinct components.
>  Any MSI containing the shared components would follow standard default
> file versioning and component rules for each DLL but because there are
> distinct components the latest version of each flavor of the DLL would be
> available in it's own unique folder and or file name.
>
> 2) Shift the business logic of which of these DLLs to load to the
> application runtime.  For example in .NET you could use some dependency
> injection to decide that DLL A is the one to be loaded.
>
> 3) The components should all get uninstalled when the last MSI is
> uninstalled because all component rules / reference counting are being
> followed.
>
>
>
> ________________________________
> From: wix-users <wix-users-bounces at lists.wixtoolset.org<mailto:
> wix-users-bounces at lists.wixtoolset.org<mailto:
> wix-users-bounces at lists.wixtoolset.org%
> 3cmailto:wix-users-bounces at lists.wixtoolset.org>>> on behalf of Walter
> Dexter via wix-users <wix-users at lists.wixtoolset.org<mailto:
> wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org%
> 3cmailto:wix-users at lists.wixtoolset.org>>>
> Sent: Friday, February 1, 2019 12:11 PM
> To: WiX Toolset Users Mailing List
> Cc: Walter Dexter
> Subject: Re: [wix-users] How can I conditionally overwrite DLLs during WIX
> installation of different packages?
>
> So, if it's at version 2, install version 4, but if it's at 3, install 5,
> just for example?
>
> I completely agree it's madness, but I'd think you could achieve it with
> some combination of properties driven by a FileSearch and components
> controlled by conditions. Haven't tried it though.
>
> It's only going to get worse if you go down this path, you're going to
> wind up with a mess in another couple generations of releases.
>
> On Thu, Jan 31, 2019 at 4:15 AM Sebastian, ChinchuX via wix-users <
> wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org
> <mailto:wix-users at lists.wixtoolset.org%
> 3cmailto:wix-users at lists.wixtoolset.org>>> wrote:
>
> > 1.     Hi All,
> > 2.       Could you please help me to find a way for conditionally
> > overwrites a DLL depending up on the version of it .
> > 3.       Create a dummy dll with different version number. Build the that
> > dlls with different Wix installation packages.
> > 4.       Check for upgrade of dlls with multiple installers.
> > 5.       Make sure that dll gets uninstalled when the last tool is
> > uninstalled.
> > Thanks & Regards,
> > Chinchu
> >
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/
> >
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
> NOTE: This email was received from an external source. Please use caution
> when opening links or attachments in the message.
> NOTE: This email was received from an external source. Please use caution
> when opening links or attachments in the message.
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/



More information about the wix-users mailing list