I was very happy upgrading to Windows 7. Virtually everything worked. All kinds of source code that I am writing compiles and runs without issues. It’s only a week later that I had to touch the AppSecInc. Community MSI extensions and discovered that most unit tests are failing. I talked about unit testing custom actions earlier. I finally got to the bottom of it.
On Windows 7 the behavior of
MSIOpenPackage has changed. We use it to run unit tests by creating a database (
MSICreateDatabase) and calling
MSIOpenPackage to get a working handle. On Windows 7 code that worked earlier always returns 0x80070645: This action is only valid for products that are currently installed. This is one obscure error code! Why do I need an installed product to open an MSI package?
Microsoft.public.platformsdk.msi was helpful [thread]. For
MsiOpenPackage to succeed you now have to have a
Property table with a populated
ProductCode value in the MSI file itself. MsiExt shim code now looks like this. The two
Execute statements are new. This incidentally demonstrates what fields you need in the MSI summary to get a valid MSI.
Hope this saves you hours of fruitless debugging.
Maybe Raymond can answer why this change in behavior in Windows 7?