[wix-users] How to ignore invalid/unavailable drive for an optional file/component?

Hoover, Jacob Jacob.Hoover at greenheck.com
Tue Dec 5 07:30:18 PST 2017

Is this a per user or per machine install?

If it’s per-user then one could justify modifying the user “home drive”.  However if it’s per machine I would simply put the artifact in a well-known location on the local machine (INSTALLDIR works), and make the application itself responsible for copying the file to the home drive if the home drive exists and the file isn’t already there.

As for your initial Condition on the component, did you have your CA scheduled before CostFinalize? It sounds like either the timing was off, you inverted the condition, or this is a per machine install which won’t be able to copy to a network location during install execute.

From: Kerem [mailto:keremispirli+wixtoolset at gmail.com]
Sent: Tuesday, December 5, 2017 2:54 AM
To: Hoover, Jacob <Jacob.Hoover at greenheck.com>
Cc: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] How to ignore invalid/unavailable drive for an optional file/component?

Hello Jacob,
Thank you for your response. I did add a Condition that checks for availability of that folder, but the only thing I achieved with it was that the error message was more user friendly. The installation still failed immediately when the dialog is closed.

Detecting and assigning properties during install time indeed sounds a bit hard to manage.

I followed your recommendation and installed the file to the install directory (that's what you mean by "locally", right?) and then copied it to user home with a Custom Action. I couldn't get <CopyFile> working with it, so I used <ExeCommand>.

<Product ...>
  <Package .../>
  <CustomAction Id='CopyFileCA' Execute='deferred' Return='ignore' Directory='INSTALLDIR' ExeCommand='cmd /c "copy <filename> [%HOMEDRIVE][%HOMEPATH]"' />
    <Custom Action='CopyFileCA' Before='InstallFinalize'>
      NOT Installed
    <Custom Action='RemoveFileCA' Before='InstallFinalize'>

This solves my problem. But since it does it silently AND I am new to WiX, I wonder if this can be done in a more "elegant" way. Or is this as good as it gets in my situation?

Thank you for your support Jacob!

Best regards,
Kerem Ispirli

30 Kas 2017 Per, 17:32 tarihinde, Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>> şunu yazdı:
Adding a Component/Condition element to the install, and a CA to detect and assign properties would allow you to avoid the message,  however then you need to deal with servicing the MSI in a different state than when the initial install was done.  Personally, I would install this file locally, and use a semi-custom action to copy the file @ install time if the drive exists and is accessible.

File/@Vital='no' would allow you to continue if it failed.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org<mailto:wix-users-bounces at lists.wixtoolset.org>] On Behalf Of Kerem via wix-users
Sent: Thursday, November 30, 2017 6:48 AM
To: wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>
Cc: Kerem <keremispirli+wixtoolset at gmail.com<mailto:keremispirli%2Bwixtoolset at gmail.com>>
Subject: [wix-users] How to ignore invalid/unavailable drive for an optional file/component?

Hello all,
First of all, apologies if this is asked before. I tried to search the archives, but search page doesn't work. I see a "Documents 1 - 10 of 41 matches. More *'s indicate a better match." message and empty space under it. I tried with latest FireFox, Chrome, Edge and (gulp!) IE.

I create my installer with WiX 3.10.3. My installer installs a file (which is optional) to user's home directory (%HOMEDRIVE%%HOMEPATH%). Recently, upon a user complaint, I discovered that:
- If the %HOMEDRIVE% is a mapped network drive but it's disconnected, then the installer shows this error: "A network error occurred while attempting to read from the file: H:\..." and installer immediately fails.
- If the %HOMEDRIVE% is a nonexistent drive, then the installer shows this
error: "Invalid Drive B:\" and installer immediately fails.

Now, I don't have anything in my .wxs file for doing these checks for availability of the drives. Apparently MSI is doing these checks
automatically: These error messages correspond to errors 1316 and 1327 in Windows Installer Error Messages list(
*My problem is that since this file is optional, I don't want these checks to be done for its path.* I couldn't find any documentation of this behaviour for neither Windows Installer nor WiX Toolset. Is there a way to disable those checks through WiX? Or any way at all?

Even if this particular file cannot be installed I want the installer to skip it and continue. Showing an error screen with "Abort" and "Skip"
options during installation would be ideal, but my Google-fu didn't cut it either.

Note: I posted the same question to StackOverflow but not only there was no answer, it got so little attention that it earned me a Tumbleweed badge. In case you're interested:

Thank you in advance!

Kerem Ispirli

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

More information about the wix-users mailing list