cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Holger_G
Level 10

MsiGetActiveDatabase() vs. Session.Database

Hi,

I am trying to convert an old VBScript custom action to InstallScript or managed code. The VBScript CA modifies the RemoveFile table at runtime during uninstallation to remove files created by the installed application.
Now I tried to perform the same action with InstallScript but it looks like that MsiDatabaseCommit does not work inside a IScript CA. I found this old post but no answer.
Why does VBScript work and InstallScript not?

Holger
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

Perhaps see the help topic "Windows Installer API Functions Example" and this ancient newsletter tip (PDF) http://www.flexerasoftware.com/webdocuments/PDF/msiaccess.pdf. You should be able to get away without MsiDatabaseCommit, since you're editing the in-memory database and not the database file...
0 Kudos
Christopher_Pai
Level 16

Since you are willing to consider managed code, you should look at WiX DTF. The object model is very similar to the automation interface used in VBScript except that it goes further to support things like disposal. It will make porting your code alot easier then porting it to InstallScript where you suddenly have to think like the Win32 API.

Check out the following link to get a feel for what database manipulation would look like in C# with DTF:

http://blog.deploymentengineering.com/2008/07/dynamic-windows-installer-ui.html
0 Kudos
Holger_G
Level 10

RobertDickau wrote:
Perhaps see the help topic "Windows Installer API Functions Example" and this ancient newsletter tip (PDF) http://www.flexerasoftware.com/webdocuments/PDF/msiaccess.pdf. You should be able to get away without MsiDatabaseCommit, since you're editing the in-memory database and not the database file...



Thanks Robert.

Christopher Painter wrote:
Since you are willing to consider managed code, you should look at WiX DTF. The object model is very similar to the automation interface used in VBScript except that it goes further to support things like disposal. It will make porting your code alot easier then porting it to InstallScript where you suddenly have to think like the Win32 API.

Check out the following link to get a feel for what database manipulation would look like in C# with DTF:

http://blog.deploymentengineering.com/2008/07/dynamic-windows-installer-ui.html



Thanks Christopher, I just tried that DynamicUI DTF CA and it works nice. That motivates me more to make use of DTF CAs and to get familiar with C# 🙂

0 Kudos
Christopher_Pai
Level 16

Cool. I'm not sure what your .NET experience is, but VB.NET and C# both compile to the same intermediate language so strategically they are equivilant. You can easily write DTF CA's using VB.NET if you choose... I don't. 🙂
0 Kudos