Reputation: 363
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.
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.
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
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.
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)
Upvotes: 1
Views: 2721
Reputation: 213
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.
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
Caveats:
Upvotes: 1