cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Tronex
Level 4

How do I show Error Message using Managed Custom Actions with Windows Installer

I am writing a managed custom action. I am using the DTF Framework from Windows Installer Xml to wrap the managed dll into a usable CA dll. The CA does what it is supposed to, but I am still having trouble with error handling:

Dim record As New Record(1)
' Field 0 intentionally left blank
' Field 1 contains error number
record(1) = 27533
session.Message(InstallMessage.Error, record)


The above code produces the following text shown in the MSI log:

MSI (c) (C4 ! C6) [13:15:08:749]: Product: TestMSI -- Error 27533. The case-sensitive passwords do not match.


The error number refers to the code contained in the Error table within the MSI. The Message shown above is correct.

My problem is: Why does Windows Installer NOT create a dialog notifying the user about the error?
Labels (1)
0 Kudos
(3) Replies
Christopher_Pai
Level 16

While I love DTF with InstallShield, it's not really an InstallShield technology so better answers will be gotten from the WiX-Users list on sourceforge/nabble.

That said, checkout:

http://msdn.microsoft.com/en-us/library/aa371672(VS.85).aspx

Notice at the bottem how the explain how to create messageboxes. Problem is, the interop seems to only expose an enum so I'm not sure how to make it work. I'm going to play with it and talk to Jason G. and then I'll get back to you on this.
0 Kudos
Tronex
Level 4

Thanks Christopher!

I crossposted the question to WiX-User earlier as you already have noticed. You are right, the discussion is better lead there.

However, in case we find a solution to this problem we should remember posting it here as well.

I am sure that many people start using DTF rather than InstallShield's solution (it's better documented, there are more samples, the WiX community is pretty responsive,...). So if anyone searches for this topic across the net, he or she should not get to a dead end here. 😉

Thanks for your help!
Christian.
0 Kudos
jasongin
Level 2

From the DTF documentation for Session.Message:

"The messageType parameter may also include message-box flags from the following enumerations: System.Windows.Forms.MessageBoxButtons, System.Windows.Forms.MessageBoxDefaultButton, System.Windows.Forms.MessageBoxIcon. These flags can be combined with the InstallMessage with a bitwise OR."

What it doesn't say is you will need to cast the result back to an InstallMessage enum. DTF's Session.Message is a very thin wrapper around MsiProcessMessage, so the behavior regarding how user messageboxes are displayed should be the same.
0 Kudos