Assuming you don't mind having an external CAB file, it's not too hard... here's a (simplified) script that I'm using to permit end-users to customize a configuration file prior to deployment. The example code modifies the MSI (which is fine for testing), however our production code creates a copy, modifies it, generates an MST against the original and finally removes the copy.
This code doesn't actually "replace" the original file, but adds a second copy which gets installed instead. Const MSI_SOURCE = "application.msi" Const FILE_REPLACE = "config.xml" Dim filesys, installer, database, view Dim objFile, size, result, objCab Set filesys=CreateObject("Scripting.FileSystemObject") Set installer = CreateObject("WindowsInstaller.Installer") Set database = installer.OpenDatabase (MSI_SOURCE, 1) Set objFile = filesys.GetFile(FILE_REPLACE) size = objFile.Size objCab.CreateCab "config.cab", False, False, False objCab.AddFile FILE_REPLACE, filesys.GetFileName(FILE_REPLACE) objCab.CloseCab Set view = database.OpenView ("SELECT LastSequence FROM Media WHERE DiskId = 1") view.Execute Set result = view.Fetch seq = result.StringData(1) + 1 ' Sequence for new configuration file Set view = database.OpenView ("INSERT INTO Media (DiskId, LastSequence, Cabinet) VALUES ('2', '" & seq & "', 'config.cab')") view.Execute Set view = database.OpenView ("UPDATE File SET FileSize = " & size & ", Sequence = " & seq & " WHERE File = '" & LCase(FILE_REPLACE) & "'") view.Execute On Wed, Nov 11, 2009 at 4:12 AM, Kim Gybels <kim.gyb...@metris.com> wrote: > This is possible using msidb which is part of the Windows Installer > Development Tools. > > I think you will need to do the following: > - extract cab file using "msidb -x" > - replace the file in the cabinet > - delete the cab file from the msi using "msidb -k" > - add the changed cabinet back using "msidb -a" > > If you do not know the name of the stream you can > use a tool like InstEdit to find out. > > If there is a shorter method please let me know. > > Best regards, > Kim > > John Daintree wrote: >> Hello all, >> >> >> >> Is it possible to replace a file in an existing MSI package without having >> to go through the build process to rebuild the whole thing? If so, how? >> >> >> >> Thanks, >> >> John >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day >> trial. Simplify your report design, integration and deployment - and focus on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> WiX-users mailing list >> WiX-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/wix-users >> >> This message and any attachment are privileged, confidential and contain >> private information. If you are not the addressee named above any >> disclosure, reproduction, copying, distribution, or other dissemination or >> use of this communication is prohibited. If you have received this >> transmission in error, please notify the sender immediately and destroy this >> e-mail. Metris does not guarantee that the integrity of this communication >> has been maintained or that >> this communication is free of viruses, interceptions or interference, and >> shall not be liable for the improper or incomplete transmission of the >> information contained in this communication nor for any delay in its receipt >> or damage to your system. Incoming and outgoing email communications may be >> monitored by Metris, as permitted by applicable law and regulations. >> >> > > > -- > > * * > > > *Kim Gybels > Software Developer > * kim.gyb...@nikonmetrology.com <mailto:kim.gyb...@nikonmetrology.com> > Tel: +32 16 74 01 00 > Fax: +32 16 74 01 03 > > *Metris Sales & Service Europe NV* > Interleuvenlaan 86 > 3001 Leuven > Belgium > www.nikonmetrology.com <http://www.nikonmetrology.com/> > > > This message and any attachment are privileged, confidential and contain > private information. If you are not the addressee named above any disclosure, > reproduction, copying, distribution, or other dissemination or use of this > communication is prohibited. If you have received this transmission in error, > please notify the sender immediately and destroy this e-mail. Metris does not > guarantee that the integrity of this communication has been maintained or that > this communication is free of viruses, interceptions or interference, and > shall not be liable for the improper or incomplete transmission of the > information contained in this communication nor for any delay in its receipt > or damage to your system. Incoming and outgoing email communications may be > monitored by Metris, as permitted by applicable law and regulations. > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users