It could make an interesting custom action. 

Microsoft CAB supports extracting files from any source (disk, stream, memory, 
etc.). Elmue's cablib 
(http://www.codeproject.com/KB/files/CABCompressExtract.aspx) knows how to deal 
with all of it, for example how to extract single files from a CAB embedded as 
a resource. You could add an implementation that extracts the file directly 
from the embedded CAB in an MSI without extracting the whole thing first.

Some C++/C# work required :)

dB. @ dblock.org 
Moscow|Geneva|Seattle|New York


-----Original Message-----
From: Niklas Söderberg [mailto:niklas.soderb...@gmail.com] 
Sent: Thursday, May 06, 2010 3:40 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Read file content from CA

Thanks for your suggestions, but I guess I didn't emphasize enough that I
need to read the file in an _immediate_ custom action, that is, I need to
read it from the installation package before the file gets installed. I
guess there's no easy way to do it, so the way I solved it was to
temporarily extract the embedded cab-file and from there extract the file I
need. A bit cumbersome, but it works.

Regards,
Niklas

On Tue, May 4, 2010 at 16:14, dB. <dbl...@dblock.org> wrote:

> There's a Win32_ReadFile immediate native (C++) CA in
> http://msiext.codeplex.com. It was added in 1.2 which hasn't shipped yet,
> but is stable - http://msiext.codeplex.com/releases/view/39468. Note that
> it doesn't support encoding, so only works for ANSI files.
>
> If you're writing a managed CA yourself, well, just read the file with
> StreamReader.ReadToEnd and then set a property with the contents read.
>
> Hope it helps,
>
> -dB.
>
> dB. @ dblock.org
> Moscow|Geneva|Seattle|New York
>
>
> -----Original Message-----
> From: Niklas Söderberg [mailto:niklas.soderb...@gmail.com]
> Sent: Tuesday, May 04, 2010 8:38 AM
> To: wix-users@lists.sourceforge.net
> Subject: [WiX-users] Read file content from CA
>
> Is it possible to get the contents of a file from a custom action (managed
> code)? I know I can get the contents of a binary item, but is it possible
> to
> somehow do the same for a regular file included in the installation
> package?
> I want to do this in an immediate custom action executed in the ui
> sequence.
>
> I'm guessing no since I've searched and googled extensively, in vain, but
> I'm still rather new to wix so perhaps I've missed something.
>
> Thanks,
> Niklas
>
> ------------------------------------------------------------------------------
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

------------------------------------------------------------------------------
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to