完全无声的MSI安装程序以prerequisites [英] Completely Silent MSI installer with prerequisites

查看:212
本文介绍了完全无声的MSI安装程序以prerequisites的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我需要创建一个无提示安装一个简单的C#应用​​程序。我使用Visual Studio安装程序(基于MSI)。既然是C#应用程序,安装程序必须安装.NET Framework为prerequisites。

I have a simple C# application which I need to create a silent installer for. I am using Visual Studio Installer (MSI-based). Since it is C# application, installer must install .NET framework as prerequisites.

在我的解决方案安装项目产生2个文件: SETUP.EXE app.msi ,引导程序和微星恭敬地文件。

Setup project in my solution produces 2 files: setup.exe, and app.msi, a bootstrapper and MSI files respectfully.

另外:安装将始终是在提升的权限,这是一个安全的假设

Also: installation would always be under elevated privileges, this is a safe assumption.

所以,我想以某种方式推出双方 SETUP.EXE app.msi 的安装完全沉默情况下,当.NET安装和未安装。

So I was trying to launch both setup.exe and app.msi in a way that installation is completely silent for cases when .NET is installed and not installed.

msiexec /i app.msi /qn

这默默工作在已安装.NET的机器,默默地失败在没有安装.NET,它的机器。

This works silently on machine that has .NET installed and silently fails on machine that does not have .NET installed.

其他组合工作的非悄无声息或显示一些弹出窗口。

Other combinations work non-silently or display some popups.

那么,有可能做出这样的安装过程中沉默? 或者,至少,让.NET安装显示弹出窗口,但应用程序本身必须保持沉默(也应该没有其他的弹出窗口,如安装程序正在初始化组件等,这是不相关的.NET安装)

So is it possible to make such installation process silent? Or, at least, let .NET installation show popups but the application itself must be silent (also, there should be no other popups like "Setup is initializing components" etc, that are not related to .NET installation)

推荐答案

引导程序的目的是安装一个链条包,通常是一组的prerequisites(有条件安装),则主包。你是不是在安装preREQ。

The purpose of a bootstrapper is to install a chain of packages, usually a set of prerequisites (conditionally installed) then the main package. Yours isn't installing the prereq.

一个廉价的方式来做到这一点是使用脚本(即使简单如一个批处理文件)作为引导程序:检测到.NET,运行.NET安装程序包,如果没有,然后运行主包安装:

A cheap way to do this is to use a script (even as simple as a batch file) as the bootstrapper: detect .NET, run the .NET installer package if absent, then run the main package install:

@echo off
rem this key/value is how WiX detects .NET 4.0 Full installation
reg query "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full" /v InstallPath >NUL 2>&1
rem sets ERRORLEVEL==0 if present, ERRORLEVEL==1 if absent

rem if .NET not found, install it:
if ERRORLEVEL 1 dotNetFx40_Full_setup.exe

rem now install main program
msiexec /i app.msi /qn

注意事项:

  • 注册表项的名称各有不同,不同的.NET版本
  • 在一些系统管理员删除或禁用的 REG.EXE 命令安全 原因
  • 有时.NET安装程序会自动重启你,而你 不会得到主包上的第一次尝试
  • 一个刚刚安装了.NET Framework有时不能完全激活,直到重新启动后
  • 蝙蝠文件非常容易被破解。那么,VBScript或JScript或什么的。不要用它们与真正的客户。一个好的引导程序(如:维克斯刻录)具有.NET检测功能 内置和更不透明的黑色帽子
  • the Registry key names vary for different .NET versions
  • some sysadmins erase or disable the reg.exe command for security reasons
  • sometimes the .NET installer will reboot on you, and you won't get to the main package on the first try
  • a just-installed .NET Framework is sometimes not fully activated until after reboot
  • .bat files are very hackable. So is VBScript or JScript or whatever. Don't use them with real customers. A good bootstrapper (e.g. WiX burn) has .NET detection features built-in and is more opaque to black hats

这篇关于完全无声的MSI安装程序以prerequisites的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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