I have been trying to find a way to get a Windows Installer component code given a product code. (I'm actually trying to get the component path for an installed product using a shortcut that doesn't contain the component code, but this is a longer story.)
I have come across the WiX DTF (Microsoft.Deployment.WindowsInstaller) assembly and this looks like a nice way to get MSI stuff done. I was very hopeful when I wrote the following code:
Session product = Installer.OpenProduct(productCode);
ComponentInfoCollection components = product.Components;
ComponentInfo component = components.FirstOrDefault();
I hoped I could get the component code from ComponentInfo. Unfortunately I see no way to do this.
Is it possible to get the component code using the WiX DTF classes? (Or any other way come to that...)