Reading the Directory table of an MSI with a custom action

566 Views Asked by At

I have a managed code custom action which uses the following code to read a custom table.

var Configfolder = session.Database.OpenView(session.Database.Tables["ProtectedConfigFolders"].SqlSelectString);

This works how ever when I try and read the directory table in the same way

var dirview = session.Database.OpenView(session.Database.Tables["Directory"].SqlSelectString);

I get

exception of type 'Microsoft.Deployment.WindowsInstaller.BadQuerySyntaxException' occurred in Microsoft.Deployment.WindowsInstaller.dll.

1

There are 1 best solutions below

1
jbudreau On

If your custom action is executed after CostFinalize you can reference the Directory table values by just just treating them like MSI properties (i.e. grab a directory the same way you would grab "ProductVersion" or "ProductName" in a custom action).