Reputation:
Can someone please tell me how to display error message in C# during execution of AfterInstallEvent?
My project uses the Microsoft set-up and deployment project and then I have created a class that is called when the AfterInstall event is fired.
MessageBox.Show(); doesn't work..."The name 'MessageBox' does not appear in the current context".
If it was that simple, I wouldn't be asking!?
Upvotes: 1
Views: 10110
Reputation:
This is very old but I'll answer anyway:
It's just a missing reference.
Add a reference to System.Windows.Forms to the project containing the class. Also add "using System.Windows.Forms;" to the top of your class file.
As far as I know there shouldn't be any issues with displaying message boxes from a custom install action.
Upvotes: 1
Reputation:
The real solution is to use scope. Something like this: global::System.Windows.Forms.MessageBox.Show(ex,"Error",MessageBoxButtons.OK, MessageBoxIcon.Error);
Cheers
Upvotes: 2