OSH
OSH

Reputation: 2937

What is the correct way of customizing an installer

My scenario is as follows:

I have a client-server application. The client is deployed through an MSI package. I would like to customize the MSI to include some details that are specific for the each installation (i.e. I need to write the address of the server into one of my configuration files; this address is different in each installation).

I am considering the following alternatives:

  1. Unpack MSI, un-compress CAB, modify file, compress CAB, create MSI (as explained in this link). The problem is that I need this to be done automatically (no GUI, no user intervention)

  2. Pass the address as a parameter to the MSI. Then during the installation read this parameter and modify the file. This is far less desirable since creating the configuration file on the client is something that I am not currently doing, and this means adding another component to the client.

  3. Create the MSI from scratch on the server.

If someone has experience doing something similar, I would appreciate the feedback.

Upvotes: 0

Views: 67

Answers (1)

Christopher Painter
Christopher Painter

Reputation: 55601

What are you using to author your installer? I know WiX and InstallShield both have custom actions designed to update XML files using XPath statements. You can do things like

For Foo.Exe.Config //appSettings/Add[@key="Server"] set Value = "[SERVERNAMEPROPERTY]"

Then you could write a custom dialog that asks the user for the value to set the property. You can also do silent installs with:

msiexec /i foo.msi /qn SERVERNAMEPROPERTY=MyServerName

Upvotes: 1

Related Questions