In researching a MSDN forum question I needed to see the current user’s credentials during a custom action during an Setup and Deployment project created from a Visual Studio 2005 project. My goal was to show a message box during install that would display the user’s credentials and domain.
What makes this project unique is that we will be using MessageBox, from the System.Windows.Forms namespace. This article shows you how to utilize a MessageBox in a custom action. Here are the steps
- Using this article as a basis Walkthrough: Creating a Custom Action we will do everything it does except do a Commit action.
- Add a reference to the dll project to include the System.Windows.Form namespace which will not be included by default.
- In the custom installer class created in the helper dll override the Install Method such as:
Then add these usings to the top of the file:
- Then in the install project unlike the Walkthrough, add the custom dll to the Custom Actions operation in the Install Node.
- Build and install. Note the message box may come up behind other windows during install, so you may have to look.
This is a quick way to show information during an install for debug purposes or user info. Note it is a modal dialog and will stop processing until the user closes the message box window.