将值从命令行传递到Custom action-Burn

时间:2014-12-10 13:59:18

标签: c# visual-studio-2010 visual-studio wix

我需要将值从命令行传递给自定义操作。自定义操作应该从命令行获取值并在安装EXE期间修改一个文件(app.config)。我在自定义中具有以下代码动作

        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/";                        
        }

我想安装exe文件,如下所示

         myapplication.exe env=test

我看到很多样本将值从命令行传递给msi。如何将值从命令行传递到CA并修改app.config文件。

1 个答案:

答案 0 :(得分:1)

除了使用自定义操作之外,还有更好的方法来执行您在此处尝试执行的操作。看看this有关如何使用WiXUtilExtension修改文件,then create a property and reference it from the command line.如果您仍然需要/想要使用引导程序,则可以在包中的MsiPackage中设置使用MsiProperty创建的属性。 / p>

相关问题