Friday, March 20, 2009

How to run an application next to installation finish in Visual studio

In your setup & deployment project

Step 1: Create a vbs file with following command

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run """" & Property("CustomActionData") & """",5,False
Set WshShell = Nothing

Step 2: Open file system (View-->Editor-->File System) window

Create a new folder (suppose, Launch) and add above vbs file into the folder.
Also add the .exe file, which should run after setup application finish.

Step 3: Open Custom Action (ViewEditorCustom Actions) window
There u can see 4 tree nodes
1. Install
2. Commit
3. Rollback
4. Uninstall
Step 4: Right click on Commit Node and select Add Custom Action

Step 5: select our vbs file from file system.
Now in Commit folder contains a vbs file

Step 6: Select the vbs file and change CustomActionData property as

[TARGETDIR]YourApp.exe

Where YourApp.exe is the name of the file you want to execute after installation
[Note : yourApp.exe and .vbs file should contain in the same folder]

For Execute an application after uninstall process

Do the same step in Uninstall folder

No comments: