Tuesday, July 22, 2008

How to promt for system restart after installing Windows Installer Package(*.msi) developed in Visual Studio

With Visual Studio one can develop variety of applications.After developing application the next step comes deploying application.For this Visual Studio supports project template called 'Setup and Deployment Projects'.With this project template one can develop setup.exe for any application developed using Visual Studio.But for some applications after deploying unless the system is restarted the application wont work as expected.The typical example for this kind of scenario is if application contains any registry additions.In such a cases its always recommended to prompt for system restart soon after completing installation.
This article describes how to achieve this.To do this one has to edit properties of *.msi file.*.msi file is created in Debug or Release folder once your setup & deployment project in visual studio is bulit.
To edit properties of *.msi file one can do it in 'Orca' editor.
'Orca' is a tool which can be used to edit properties of Windows Installer Packages(*.msi) .For more info on Orca visit http://msdn.microsoft.com/en-us/library/aa370557.aspx

The next step is edit properties .open your *msi file in Orca editor with the help of 'Open' menu item in 'File' menu.Take a look at image below.

After opening *.msi file in Orca editor you will find 'Table' pane on right side of the editor.Under 'Table' select 'Property' to select property table.This shows the list of properties & its values in right pane.Right click the 'Property' header & select 'Add Row' menu item.Then a pop up will be opened where name & value of property give.Give 'REBOOT' as name & 'Force' as value & save.Its done now.If you install that package(*.msi) then after completion of installing a automatic popup will appear prompting for system restart.Chekout image below.

No comments: