Click here to Skip to main content
15,398,432 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am using windows server2008 r2 and visual studio 2010

1) I have developed a windows forms application which has some textboxes and buttons.
2) I have built an setup project using visual studio installer.

Now i have added the setup.exe/msi package to the forms application. once the user clicks on a particular button the setup.exe/msi package should start its installation. i have googled many forums but got with this solution.

Process p = new Process();
    p.StartInfo.FileName = @"Path to the exe\setup.exe";

This solution is good if the user machine has the setup.exe file. But my problem is when we give it to the client they will not be having the setup.exe on their machine. So this way of mentioning the path will not work out. i need a solution wherein the setup.exe/msi package should start installing on a button click without mentioning the path.

Looking forward for your help in this scenario. Many thanks in advance. plz help me out
Updated 8-Apr-13 19:16pm
If you develop MSI and Setup.EXE, why the user cannot simply execute it?
shivanand3291 9-Apr-13 1:30am
Yeah you are right sergey but i have certain configuration settings to be done using that form and once it is done i want to launch this msi file upon a button click
Prasad Khandekar 9-Apr-13 1:37am
Hello Shivani,

You can do certain configuration settings via setup scripts as well.

shivanand3291 9-Apr-13 1:44am
@prasad khandekar: Do you mean writing .vbs scripts to do iis configuration settings?

1 solution

Paste your setup.exe in same folder where your form is running and use this
p.StartInfo.FileName = Path.Combine(Application.StartupPath, "setup.exe")
shivanand3291 9-Apr-13 1:42am
The name 'path' does not exist in the current context error. what does this mean nasir?
Nasir M@hmood 9-Apr-13 2:04am
add reference System.IO or use System.IO.Path and it is "Path" not "path"
shivanand3291 9-Apr-13 2:51am
ya it worked..Thanks nasir !!!
Thirumadhi T Johnson 13-Jul-22 23:22pm
Hi @Nasir M@hmood and @Shivanand even I am also looking for same requirement even I too installed VS installer in VS 2015 but where and How we can mention this p.StartInfo.FileName = Path.Combine(Application.StartupPath, "setup.exe") please help me too

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900