cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
seth_at_work
Level 3

Passing TFS build parameters to InstallScript project

I've been customizing an XAML template to build my InstallScript project, but I have a major problem that I cannot figure out for the life of me: I need to take build parameters from TFS and pass them to my InstallScript project. For example, I have a preprocessor define called DATA_YEAR and a TFS parameter called DataYear. Is there any way to pass that parameter value to the preprocessor define? I need to do the same with path variables too.

I have a SLN file and ISPROJ file, and I can build just fine if I set the preprocessor defines in the release definition, and use the existing values for path variables.
Labels (1)
0 Kudos
(1) Reply
MGarrett
Level 6

We pass several build parameters from TFS to Installshield.

First, in your .ISM file, create a Path Variable for each value you want to pass in. Give them a default value (the default value will be used when you build without TFS build). You can use these Path Variables other places in your installation, such as component source and destinations, InstallScript, Custom Actions, etc.


Now to TFS: I will assume that you know how to create and set a variable in your XAML build template. In our XAML Build Template, we use InvokeProcess to call InstallShield with various parameters. The magic happens by calling Installshield with the -l parameter. Then, pass in the parameter name and its value. We use String.Format to put it all together.
In our InvokeProcess, we use the following:

DisplayName: Invoke InstallShield 2013
FileName: """C:\Program Files (x86)\InstallShield\2013 SP1 SAB\System\IsCmdBld.exe"""
WorkingDirectory: "C:\Program Files (x86)\InstallShield\2013 SP1 SAB\System"
Arguments: String.Format("-p ""{0}\Installer\ProgramA.ism"" -l ProgramASources=""{1}"" -l ProgramABinaries=""{2}"" -l DeployDir=""{3}"" -l BuildDefinitionName=""{4}"" -r {5}", SourcesDirectory, SourcesDirectory, BinariesDirectory, "\\servername\SoftwareBuilds\ProgramA\" + BuildDetail.BuildDefinition.Name, BuildDetail.BuildDefinition.Name, ProgramARelease)

The first parameter -p is the path to the .ISM file you are building
The -l parameter is used to override an existing path variable with a new value. You can specify -l multiple times for multiple path variable overrides. Note that the path variable doesn't actually have to be a fully qualified path. It can be a string.
The -r parameter specifies the name of the release (optional, but recommended if you have more than one release configuration in your .ISM)
There are other parameters available - See the InstallShield help topic ISCmdBld.exe.

Of course, you can customize the Arguments to be whatever you need. This is just an example of what we are doing, so I hope this helps. There are a lot of moving parts here, so it can be a little confusing at first. Good Luck!
0 Kudos