Click here to Skip to main content
15,921,452 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to install an application from my C# code. I have the exe file and I want to install silently without knowing to the user. Clicking 'Next', 'Finish' buttons should be handled internally.
I was trying to use the Process class, I could able to run the exe but do not know how to make it silent.

Could any one help me?
Posted
Updated 3-Apr-19 5:18am
v2
Comments
dattaprasaddhuri 24-Feb-17 6:23am    
I try this code but i required to run visual studio in administrator mode then only file is installing otherwise not.
Can u tell me how to install when visual studio run in normal mode

For a VS based msi, it can be installed silently passing the right command line parameters.
Based on MSDN: Standard Installer Command-Line Options[^], /passive will do it.


You can also look at, MSDN: ClickOnce Deployment for Windows Forms Applications[^] that enables self-updating Windows-based applications that can be installed and run with minimal user interaction.


UPDATE: Just saw exact same question asked year and half back: silent installation of exe file using c#.net[^]
 
Share this answer
 
v2
if you are using MSI files then try

C# Code to install MSI silently and know when it is done

If you want to install an application that is packaged as an .MSI and you want to know when the application has finished installing, use this code:
C#
string installerFilePath; 
installerFilePath = "C:\\Program Files\\CCS\\Downloads\\CCSRPTSetup.msi"; System.Diagnostics.Process installerProcess; 
installerProcess = System.Diagnostics.Process.Start(installerFilePath, "/q"); 
while (installerProcess.HasExited==false) 
{ 
//indicate progress to user 
Application.DoEvents(); 
System.Threading.Thread.Sleep(250); 
} 
MessageBox.Show("done installing");
 
Share this answer
 
Hi please assist as I cannot get the silent installation to work

<pre lang="c#">try
            {
                string installerFilePath = @"C:\BennaOlivier\Randoms\Delter\Firebird\FirebirdMainInstaller\MainInstaller\MainInstaller\Firebird X64\FirebirdInstallX64\Firebird-2.5x64.exe";
                Process installerProcess = new Process();
                installerProcess.StartInfo.CreateNoWindow = true;
                installerProcess.StartInfo.RedirectStandardOutput = true;
                installerProcess = Process.Start(installerFilePath, Arguments);

                while (installerProcess.HasExited == false)
                {
                    //indicate progress to user 
                    Application.DoEvents();
                    System.Threading.Thread.Sleep(250);
                }

            }


My Arguments that I pass are as follows

C#
private const string Arguments = " /SILENT | /VERYSILENT [/SUPPRESSMSGBOXES]";


However when doing the install I still get the window and the create no window defaults to false
 
Share this answer
 
Comments
CHill60 4-Apr-19 4:13am    
If you have a question then use the red "Ask a Question" link at the top of this page. It is a pointless exercise adding a question as a "Solution" to someone else's query.

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