Findings from my work with Visual Studio

  • Adding msi parameters in Visual Studio Setup Project

    I can’t find how and where to add the parameter list of the msi.

    I had to modify a setup project of which creates an msi for an application.

    During modification I had to add an extra parameter that should be given to the msi during installation.

    While I searched I found only how to read the parameters supplied from command line using Context.Parameters.

    But I can’t find at any place where to specify the parameters those can be supplied with msi. Finally I found it and so I am writing here as it may be useful to others.

     

     

    This is how it could be done:

     

    In the Solution explorer of a setup project:

    right click on project and in view option, select Custom Actions.

    The Custom Actions page contains the different functions Install, Uninstall, Rollback which will be overridden by our setup project's installer class.

    In property Pages of Install, in the option CustomEvents, we can specify the arguments.

     

    For example if for our msi, we have to add 2 parameters INSTLOG & X

    Then in the CustomEvents, we have to specify it as:

                /INSTLOG=”[INSTLOG]” /X=”[X]”

     

    Now the INSTLOG and X will become the keys of Context.Parameters.

    These parameters can be accessed in our code using Context.Parameters.

    The Context.Parameters contains the command-line passed when msi is run.

     

    While running msi, these will be takes as parameters only when they are specified in Custom Events only, otherwise not considered.

     

    If the msi name is buildMySoftware

     

    Then the msi can be run as

                >buildMySoftware INSTLOG=”xyz.log” X=”k”

     

This Blog

Syndication

Tags

No tags have been created or used yet.

Archives


© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker