Home Ask Login Register

Developers Planet

Your answer is one click away!

Brian February 2016

Editing packaged file in WiX

WiX newbie here. I'm curious if this approach is possible using WiX.

Problem statement...

I am packaging some SQL files that I want to execute against some parameters that the user will enter at run time. Think connection string information. One of the parameters that the user can enter is the directory where they want the DB to be installed.

Current solution (doesn't work).....

To do this i'm packaging these files using heat. When it sucks in this files one of my SQL files has some tokens in them that a custom action looks for to basically do a find replace in the file. The problem is thatwhile it is indeed doing a find replace it's doing them against the source files that heat sucked in and not the files that exist in the .msi file.

Question 1...

Within the WiX workflow is there a way that via a custom action I can do processing on the files that are stored within the .cab or .msi file? If that is possible can someone show me an example of this?

Question 2 . . .

If question 1 isn't possible the other idea I had was to break the find replace SQL piece and the file install piece into separate msi file. So the first step would be to explode all the files I need into the install directory via one msi. The next msi would execute the SQL piece as at that point the files exist on the file system for me to do editing on. Does this sound like a sane approach to the problem? It could very well be that I'm trying to work around WiX and not with WiX here.

Current code snippets

   <!-- This is where this will be installed-->
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="INSTALLFOLDER" Name="ZOLLData">
            <Directory Id="SQLINSTALLFOLDER" Name="Sql" />

    <CustomAction Id="FindReplaceZEDSTextCA"


Brian February 2016

The problem was the my custom action was set with Execute="immediate". This should have been Execute="deferred".

Post Status

Asked in February 2016
Viewed 1,228 times
Voted 14
Answered 1 times


Leave an answer

Quote of the day: live life