I am creating a wix installer. In some of the wxs file i have defined some properties and i am also creating some session properties inside C# custom action.
Now my requirement is to list out all session properties. So for this i have queried Property table and got all properties that where defined in .wxs file.
For this i have used below custom action:
Microsoft.Deployment.WindowsInstaller.View listBoxView = session.Database.OpenView(string.Format("select * from Property"));
listBoxView.Execute();
while (true)
{
using (Record r = listBoxView.Fetch())
{
if (r == null)
{
break;
}
else
{
Console.WriteLine(r[1].ToString(), r[2].ToString());
}
}
}
}
}
But it does not list out any session property that i have created using c# custom action.
Can someone help me how to list out properties that i created using c# custom action or where these properties get stored?
Thanks much
When you query the property table the way you do in your sample, you get only those properties defined statically in your WiX authoring, and this is expected. At install-time there's a concept called in-memory property collection - this consists out of all the properties defined in various ways: statically in Property table, provided via the command-line, system, defined in custom actions, etc.
You can access all those properties via the Session
object. Just call session[name]
, where name
is the name of the property you're going to get. I doubt there's an enumerator defined for properties, but in real life you rarely need to iterate the properties - you rather try to get a certain one.