hitman126
hitman126

Reputation: 951

Update MSI properties programmatically

I need a solution for something that should hopefully be fairly simple - updating an MSI property. We have a number of WiX projects which are source controlled in TFS 2012 and we generate their related MSIs for deployment through TeamCity build configurations which generally build the required *.wixproj files.

Updating the MSI property in TFS/Visual Studio isn't an option to be pursued at all, as we need to confine our change to TeamCity, due to how our entire Continuous Integration and deployment process is currently set up.

What I wish to therefore implement is a solution where I can run a script or command to update the required MSI property after it's been created. I will welcome a solution using any script or command from Powershell, Perl, VBScript, Windows Batch script, etc, as this will be set up as a final TeamCity build step to modify the created MSI.

Thank you.

Upvotes: 3

Views: 2491

Answers (4)

hitman126
hitman126

Reputation: 951

Thanks for all the great feedback.

I actually found a VBScript solution that does the job brilliantly by updating the required property of my previously-built MSI. I have set it up as a build step which runs after my MSI is created in a preceding Team City build step.

Unfortunately, I have the script saved on my office PC and don't therefore have access to it to share at this minute. I will however do so when I'm in the office after this weekend.

Upvotes: 0

Stein Åsmul
Stein Åsmul

Reputation: 42226

Perhaps you can try using DTF (Deployment Tools Foundation). I have written about it in this answer on serverfault. Please follow the link for more information.

Upvotes: 0

PhilDW
PhilDW

Reputation: 20790

Assuming you mean you want to modify MSI properties in a previously-built MSI file, then basically find the WinRunSQL.vbs file in the Windows Kit/SDK and then learn the SQL commands to update the properties in the Property table. There are examples here: http://msdn.microsoft.com/en-us/library/aa372021(v=vs.85).aspx

I'm assuming you know enough about MSI to know that the properties you're referring to are likely the ones in the Property table.

Upvotes: 1

oɔɯǝɹ
oɔɯǝɹ

Reputation: 7625

You can use msiinfo.exe (which is part of the Windows SDK) for reading / adding / updating msi properties.

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\MsiInfo.Exe>msiinfo.exe /?
MsiInfo V 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved

++MsiInfo.exe Command Line Syntax++
MsiInfo.exe {database} --> To Display Summary Info Properties
MsiInfo.exe {database} Options.... --> To Set Summary Info Properties
++MsiInfo.exe Options++
PID_DICTIONARY   - /I {value}
PID_CODEPAGE     - /C {value}
PID_TITLE        - /T {value}
PID_SUBJECT      - /J {value}
PID_AUTHOR       - /A {value}
PID_KEYWORDS     - /K {value}
PID_COMMENTS     - /O {value}
PID_TEMPLATE     - /P {value}
PID_LASTAUTHOR   - /L {value}
PID_REVNUMBER    - /V {value}
PID_EDITTIME     - /E {value}
PID_LASTPRINTED  - /S {value}
PID_CREATE_DTM   - /R {value}
PID_LASTSAVE_DTM - /Q {value}
PID_PAGECOUNT    - /G {value}
PID_WORDCOUNT    - /W {value}
PID_CHARCOUNT    - /H {value}
PID_THUMBNAIL    - NOT SUPPORTED
PID_APPNAME      - /N {value}
PID_SECURITY     - /U {value}
Validate String Pool - [/B] /D  (use /B to display the string pool)
/?               - Displays this help message
/nologo          - Do not display the logo message

For example, you can set the Author and Subject properties as follows:

msiinfo.exe my.msi /A "Your name" /J "This is a demo"

Be aware that you cannot use msiinfo.exe my.msi /I to read single properties, as it will try to update the property instead (effectively clearing the value).

Upvotes: 2

Related Questions