Royal
Royal

Reputation: 752

Pass value from command line to Custom action-Burn

I am in a need to pass the value from command line to custom action.The custom action should get the value from command line and modify one file(app.config) during installation of EXE.I have the below code in custom action

        if (Context.Parameters["ENV"] == "test") //Test environment
        {              
            authEndPoint = "http://192.168.168.4/api/user_authentication/";                        
        }
        else if (Context.Parameters["ENV"] == " ") //Production environment
        {              
            authEndPoint = "https://livesiteurl/api/user_authentication/";                        
        }

I want to install the exe file like below

         myapplication.exe env=test

I seen lot of sample to pass the value from command line to msi. How to pass the value from command line to CA and modify the app.config file.

Upvotes: 0

Views: 121

Answers (1)

Rick Bowerman
Rick Bowerman

Reputation: 1884

There are better ways to do what you're trying to do here than use a custom action. Take a look at this for how use the WiXUtilExtension to modify the file, then create a property and reference it from the command line. If you still need/want to use a bootstrapper you can set that property you created with MsiProperty inside MsiPackage in the bundle.

Upvotes: 1

Related Questions