Subject: Passing parameter to msi installer
Prev Next
You are not authorized to post a reply.

AuthorMessages
BobUser is Offline
New Poster
New Poster
Posts:1

05/20/2010 3:00 PM  

I am trying to pass a parameter to the msi through the command line in C#.

Here it is:   msiexec /I setup.msi /qn USER=Joe

I created an installer class that writes to a registry key.  I have setup a Custom Action for Install that has the code to write to a registry key in it. 

If I hardcode the value for the registry key, that value is written correctly to the registry key in the custom action.  However, I am not able to retrieve my value from the command line (USER=Joe).  I would much appreciate any help.

CustomActionData Property for Custom Action for Install:    /user="USERNAME"

Here is my code in the Installer Class:

        public override void Install(IDictionary savedState)
        {
            base.Install(savedState);
            // string username = “Joe”   (This writes correctly to the registry key if hardcoded)
            string username = ??? (

            // Code to write to registry key using the username value above
        }

How do I retrieve the USER=Joe from the msiexec command line above?

Thanks,
bsmengen

Mitchel SellersUser is Offline
Site Admin/Owner
Guru
Guru
Posts:6089

06/01/2010 12:55 PM  
I don't believe that you are going to get access to this easily. Potentially using references through the Application object would be the only way I can think of.

-Mitchel Sellers
Microsoft C# MVP, MCITP
Director of Development
IowaComputerGurus Inc.

View Mitchel Sellers's profile on LinkedIn

For shared hosting I recommend PowerDNN

This site is hosted on a Dedicated Server from PowerDNN.com

To get Guaranteed DNN Support check out our affordable DNN Technical Support Programs
You are not authorized to post a reply.
Forums >Development Discussion >.NET Development > Passing parameter to msi installer



ActiveForums 3.7