views:

1127

answers:

3

As you might know, msiexec is a command line app that you can use to install an MSI file. As you might know, you can run it in silent or invisible mode.

My question is this. If the installer requires the user to answer specific questions about what parts to install, is there some way that I can put in the msiexec command line a series of options to do this?

I figure there must be some sort of way of setting the MSI file's default settings to make this happen. So the second part of my questioin is, how are MSI files made? Are they developed through tools from Microsoft? Can they be opened and edited?

+1  A: 

How to configure silent MSI setup

An MSI installation can be configured on the command line by setting the properties that the installer uses. There are pre-defined Windows Installer properties such as the ALLUSERS property. This property defines whether an installation will be done in the context of the current user or the machine.

Information on the available properties can e.g. be obtained from an install log which can be created using msiexec's /l option

msiexec /I mysetup.msi /l*vx log.txt

How to create MSI files

There are many ways to create MSI files. An MSI file is basically a database consisting of various tables containing all necessary setup information and installation dialogs.

Microsoft offers a simple tool call Orca which enables you to edit existing MSI files and allows you to find out which properties can be set to configure an installation. Theoretically it is also possible to create new MSI files using this tool but it is a very cumbersome way to go.

If you are looking for a free and open source solution I would recommend you to have a look at the WiX toolset available on SourceForge or the Nullsoft . All setup information is done via XML files which are then converted into an MSI installer. WiX is stable (although still tagged beta) and can be used in production. Actually it will be integrated in the upcoming version of Visual Studio 2010.

Of course there are also commercial solutions available, InstallShield being the market leader (also being the price leader) and Visual Studio probably being the most wide-spread tool.

0xA3
+10  A: 

Think of the user interface with MSI as optional. This means no answers should be required as the developer has sensible defaults in place so that things don't break.

We distribute our software in MSI format to corporate customers, I also provide them with documentation on the basics of Orca (orca.msi is distributed with the Windows Installer SDK) and how to customize certain fields we have listed in the Property table for their installation. Such as serial number, registration details and a few other settings.

In response to the original question about msiexec command line options just run MSIEXEC /? to set properties on the command line you would use something like

MSIEXEC /I test.msi SOMEPROPERTY="Some value" PROP2="something else"
sascha
It's important to add that only PUBLIC properties can be set by command line, so when creating the msi script make sure that properties that will be set by the command line will be in Uppercase
CheGueVerra
On an MSI development note, you need to ensure that properties are PUBLIC and SECURE if you want them to be passed thru to the elevated UAC context - http://msdn.microsoft.com/en-au/library/aa371571(VS.85).aspx
sascha
+2  A: 

MSI is often counterintuitive and somewhat complicated under the hood. However, to over-simplify an MSI file contains one or more "Features" - and these features collectively constitute the "bits of the application" as you put it.

You can generally find a list of these features by running the setup interactively, and navigate to the customize install dialog (not always present). Features that show up here are normally the "user configurable" parts of the application that can be chosen for exclusion or inclusion. Typical features are: Dictionaries, Samples, Plug-Ins, etc... Anything that the application doesn't really need to function, but that's included in the setup.

There are generally 2 ways to customize an MSI installation: using msiexec.exe custom command lines, or using transform files.


1: msiexec.exe command line:

The simplest and light-weight way of controlling what features are installed during an installation, is to specify your feature selection using the msiexec.exe command line. There is a whole family of properties used for feature configuration. But, in most cases it is sufficient to specify ADDLOCAL:

msiexec.exe /i myinstaller.msi ADDLOCAL="Program,Dictionaries" /qn

The above command line specifies that the features "Program" and "Dictionaries" should be installed locally (feature names are cases-sensitive!). This is generally enough, but you can also specify any features that you want to remove using the REMOVE property in a similar fashion. A special switch is ADDLOCAL=ALL which will install all features in the MSI on the local disk (provided there is not additional logic in the MSI to override this). ADDLOCAL property on MSDN:


2: Transforms

MSI files are essentially SQL-databases wrapped in COM structured storage files. Transform files are "partial databases" constructed via installation tools such as Orca, Installshield or Wise, etc... These transforms can customize or override almost all settings or database fields in an MSI - including what "parts of the application" (features) are installed. After creating a transform you specify its application to the MSI at the msiexec.exe command line:

msiexec.exe /i myinstaller.msi TRANSFORMS="mytransform.mst" /qn

Windows Installer will then merge the MSI and the tranform before installation starts. This is the approach used by large organizations who want full control of how the MSI gets installed. TRANSFORMS property on MSDN


A reasonably good: summary of Windows Installer.

Glytzhkof