[wix-users] How to include a file as a binary and use it in a WixCA command line

Edwin Castro egcastr at gmail.com
Thu May 5 11:06:36 PDT 2016


Hi Gary,

Unfortunately, the Windows Installer doesn't support a way to
temporarily extract a binary from the Binary table. The WiX toolset
does not yet provide a mechanism to do this either although it is
often requested. My guess is that there's a management element here
that is difficult to schedule properly. Since the extraction should be
temporary, then the file should be cleaned up toward the end of the
installation.

Basically, you have two options:

1. Install the binary and use it on a custom action command line
(which I understand you do not want to do)
2. Write your own binary custom action (native or managed) to extract
the temporary file out of the Binary table, write the file to disk,
use it as part of your command line, and finally delete the temporary
file.

In the first case you avoid explicit clean up because the file is
installed and will be uninstalled when the product is uninstalled.

The second option is more work.

--

On Tue, May 3, 2016 at 2:07 PM, Gary M <garym at oedata.com> wrote:
> Thanks for the reply Walter
>
> The WixCA uses a different construct. The command line is formed in a
> unique customaction. The executing customaction uses the Property attribute
>  to link the command line to to the WixCA dll.  I would need a reference to
> accessible to replace string: [INSTALLER_SCRIPTS_DIR]install-smtp.ps1
>
>
>     <CustomAction Id="installSMTPCmdLine"
>                   Property="installSMTPExec"
>
> Value=""C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe"
> -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -InputFormat
> None -File [INSTALLER_SCRIPTS_DIR]install-smtp.ps1"
>                   Execute="immediate" />
>
>     <CustomAction Id="installSMTPExec"
>                   BinaryKey="WixCA"
>                   DllEntry="CAQuietExec64"
>                   Execute="deferred"
>                   Return="check"
>                   Impersonate="no" />
>
>
>
> On Tue, May 3, 2016 at 10:51 AM, Walter Dexter <wfdexter at gmail.com> wrote:
>
>> Try this. I think it's right.
>>
>> <Binary Id="CreateHostsEXE"
>> SourceFile="../../scripts/generateHostsFile.exe" />
>> <CustomAction Id="OurAction"
>>               FileKey="CreateHostsEXE"
>>               ExeCommand="our command line args"
>>               Execute="deferred"
>>               Return="check" />
>>
>>
>> On Tue, May 3, 2016 at 6:09 AM, Gary M <garym at oedata.com> wrote:
>>
>> > Hi,
>> >
>> > I have a few script files used with WixCA  command line. I would like to
>> > access the file without having them installed. I'm looking to define the
>> > scripts treated as  <binary>,  but don't know how to address them ie push
>> > them into a command line.
>> >
>> > Help is appreciated
>> >
>> > ____________________________________________________________________
>> > 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/


More information about the wix-users mailing list