I need to modify an MSI file, and I'd like to do it in code. I can do it via command line using cscript.exe and wirunsql.vbs, but I can't figure out how to do it in .Net. I know it can be done, as I've found snippets of other peop开发者_运维知识库le doing something, but they don't say what to include or where to get it. I have the Windows Platform SDK, but not the samples (I'm having difficulty getting them to download). I also have the latest version of WiX, which I think is a part of Windows Installer 3.0?
So what do I need to include in my project to run a SQL query against an MSI file? Is there a good example online?
You should look at WiX 3.0 DTF. It has a managed API ( Microsoft.Deployment.WindowsInstaller ) that encapsulates all of the Win32 MSI API and even extends it with a QDatabase class that supports Linq-To-MSI. Using late bound COM interop against WindowsInstaller.Installer is just horrible compared to DTF. This is C# not VBScript.
Not getting any traction on this, I put up a more general question, asking for any way to modify an MSI in code (not just using Wirunsql.vbs). I managed to get something similar working in C#. You can see the solution here.
精彩评论