locked
Get/Set Window Installer properties for Setup project (MsiGetProperty, MsiSetProperty) RRS feed

  • Question

  • I currently i have solution with 2 projects: setup project and Class Library (for custom action).
    From Class Library project, i overwrite AfterInstall function. But within this, i would like to get/set some properties for the installers.
    Is there a way I can do something like MsiGetProperty, MsiSetProperty in c#?

    Thx 
    Friday, February 12, 2010 6:53 PM

Answers

  • Hi garynguyen,

    To get some properties, you can use CustomActionData. The following FAQ talks about it.
    http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/717cfce0-3061-400f-9ea3-069f73f3a473

    You can turn to “5. How can I use CustomActionData to get user input from an installation interface in my custom action? ” The detail description of CustomActionData and samples are in the reference link.

    As for set the property, it cannot be set with CustomAction. All the properties of installer are set before you installing the application. CustomAction event fires after installation.

    Sincerely,
    Kira Qian
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
    • Marked as answer by Kira Qian Thursday, February 25, 2010 6:29 AM
    Monday, February 15, 2010 2:08 AM
  • No, you can't, not directly. To use those APIs you must have access to the handle for the install. You can do it in C++ custom actions, but the wrapper that lets you run managed code on an msiexec process doesn't pass the handle into the managed code. If you want to pass a property called FRED into your installer class install method, then you just pass it via CustomActionData in the /arg=[FRED] format.
    Phil Wilson
    • Marked as answer by Kira Qian Thursday, February 25, 2010 6:29 AM
    Tuesday, February 16, 2010 9:21 PM

All replies

  • Hi garynguyen,

    To get some properties, you can use CustomActionData. The following FAQ talks about it.
    http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/717cfce0-3061-400f-9ea3-069f73f3a473

    You can turn to “5. How can I use CustomActionData to get user input from an installation interface in my custom action? ” The detail description of CustomActionData and samples are in the reference link.

    As for set the property, it cannot be set with CustomAction. All the properties of installer are set before you installing the application. CustomAction event fires after installation.

    Sincerely,
    Kira Qian
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
    • Marked as answer by Kira Qian Thursday, February 25, 2010 6:29 AM
    Monday, February 15, 2010 2:08 AM
  • No, you can't, not directly. To use those APIs you must have access to the handle for the install. You can do it in C++ custom actions, but the wrapper that lets you run managed code on an msiexec process doesn't pass the handle into the managed code. If you want to pass a property called FRED into your installer class install method, then you just pass it via CustomActionData in the /arg=[FRED] format.
    Phil Wilson
    • Marked as answer by Kira Qian Thursday, February 25, 2010 6:29 AM
    Tuesday, February 16, 2010 9:21 PM
  • Hi garynguyen,

    I am writing to check the status of the issue on your side. Could you please let me know if the suggestion works for you? If you have any questions or concerns, please feel free to let me know. I will be more than happy to be of assistance.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
    Monday, February 22, 2010 8:59 AM