检测.NET自定义操作静默安装 [英] Detect silent install in .NET Custom Action

查看:163
本文介绍了检测.NET自定义操作静默安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何检测安装在无声模式下运行?

How do you detect that the install is running in silent mode?

我有我添加了一个的.msi安装项目自定义应用程序。我使用/ qb开关.msi文件,并在我的自定义安装程序的C#代码,我想能够检测到这种

I have a custom application that I've added a .msi setup project. I run the .msi file with the /qb switch, and in my custom installer c# code I would like to be able to detect this.

编辑:nobugs说测试在UILevel财产。我如何从System.Configuration.Install.Installer类派生的类访问UILevel财产?

nobugs says to test the UILevel property. How do I access the UILevel property from a class derived from the System.Configuration.Install.Installer class?

推荐答案

拍摄的提示从nobugz,我做了以下内容:

Taking the hint from nobugz, I did the following:


  1. 在自定义操作视图的.msi安装项目,我添加了以下内容我CustomActionData(通过我的自定义安装程序传递的UILevel):

  1. On the Custom Actions view of the .msi setup project, I added the following to my CustomActionData (to pass the UILevel through to my custom installer):

/ UILevel =[UILevel]

/UILevel="[UILevel]"

在从基类派生安装程序中的代码我的C#代码,我添加代码来获取值:

Within my C# code for the code derived from base class Installer, I added code to get the value:

字符串uiLevelString = Context.Parameters [UILevel ];

string uiLevelString = Context.Parameters["UILevel"];

这是再简单解析为int值的字符串。如果该值为< = 3,这是一个静默安装

It was then simple to parse the string for an int value. If the value is <= 3, it is a silent install.

这篇关于检测.NET自定义操作静默安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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