问题描述:

I have a C# Windows Forms application and I have added a setup project to its solution to create MSI Installer.

I would like to provide some custom error messages to the end users when they're installing the software but it's showing

Error 1001. An exception occurred in the OnBeforeInstall Event Handler.

on rollback.

Could you please help me: how to implement custom error messages to the end user in this case?

网友答案:

Instead of checking conditions in OnBeforeInstall Event Handler, try putting that code inside

Install Event Handler

and for getting out of installation process on failure of your custom condition/check do:

throw new InstallException("Custom Message.");

This will result in : Error 1001.Custom Message.

Another approach would be using Orca with your msi to edit the built-in messages.

相关阅读:
Top