Create Transform in vbscript
Posted 04 November 2003 - 22:51
When I use a tool like InstallShield Developer however, I can create a MST directly. Or is the interface just making me believe I am changing a transform and is it actually modifying a copy of the MSI?
The only methods I could find in the SDK documentation (CreateTransformSummaryInfo and GenerateTransform) create a transform by comparing two MSI's, and that is not what I'm trying to do. I'd like to create and/or edit the MST directly. Can it be done?
Posted 05 November 2003 - 10:34
Posted 08 November 2003 - 21:30
My code looks like this:
|Set installer = Wscript.CreateObject("WindowsInstaller.Installer")|
' Copy "Test.msi" to "Copy of Test.msi"
Set orgdatabase = installer.OpenDatabase("Test.msi", 0)
Set database = installer.OpenDatabase("Copy of Test.msi", 2)
database.ApplyTransform "Test.mst", 0
' Make some changes to database
database.GenerateTransform orgDatabase, "Test.mst"
When I run this script, I get an error message on the GenerateTransform. The message is a Msi API Error with code 0x080004005 in GenerateTransform,ReferenceDatabase,Transformfile.
I've been able to work adourn this by adding the following line just before the GenerateTransform
|Set database = Nothing: Set database = installer.OpenDatabase("Copy of Test.msi", 2)|
It seems like the ApplyTransform opens Test.mst and keeps it open. Any ideas on a way to close only the mst and keep the msi open? It seems silly I'd have to close and reopen my msi for something like this. I also haven't been able to find any info on the error message itself. Where would I find what the message means?
Edited by comecme, 09 November 2003 - 00:15.