C#,。Net中的无提示安装。 [英] Silent Installation in C#, .Net.

查看:58
本文介绍了C#,。Net中的无提示安装。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从我的C#代码安装应用程序。我有exe文件,我想在不知道用户的情况下静默安装。单击下一步,完成按钮应该在内部处理。

我试图使用Process类,我可以运行exe但不知道如何让它保持沉默。 />


可以任何一个帮助我吗?

解决方案
对于基于VS微星,它可以安装默默传递正确的命令行参数。

基于 MSDN:标准安装程序命令 - 行选项 [ ^ ], /被动将会这样做。





您还可以查看, MSDN:ClickOnce部署Windows窗体应用程序 [ ^ ]启用基于Windows的自我更新应用程序可以用最少的用户交互来安装和运行。





更新:刚看到完全相同的问题问一年半回:使用c#.net 静默安装exe文件[ ^ ]


文件然后尝试



C#默认安装MSI的代码,知道什么时候完成



如果你想要要安装打包为.MSI的应用程序,并且您想知道应用程序何时完成安装,请使用以下代码:

 字符串 installerFilePath; 
installerFilePath = C:\\Program Files \\CCS \\Downloads \\ \\\CCSRPTSetup.msi; System.Diagnostics.Process installerProcess;
installerProcess = System.Diagnostics.Process.Start(installerFilePath,<跨度类= 代码串> <跨度类= 代码串 > / Q);
while (installerProcess.HasExited == false
{
// 表示用户进度
Application.DoEvents();
System.Threading.Thread.Sleep( 250 );
}
MessageBox.Show( 已完成安装);


嗨请协助,因为我无法使静音安装工作

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

while(installerProcess.HasExited == false)
{
//表示用户进度
Application.DoEvents();
System.Threading.Thread.Sleep(250);
}

}





我通过的论点如下



  private   const  < span class =code-keyword> string  Arguments =   / SILENT | / VERYSILENT [/ SUPPRESSMSGBOXES] ; 





但是在进行安装时我仍然会看到窗口并且create no window默认为false


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?

解决方案

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[^]


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:

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");


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

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


这篇关于C#,。Net中的无提示安装。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆