Having trouble setting a variable from the command line during build using cli.exe

Comments

2 comments

  • Avatar
    wojciechka

    Variables specified in --setvars are set before <preBuildActionList> actions are run, so your actions simply overwrite the values specified in command line.

    You can simply add a check if BuildDir was previously specified - in this case it should be enough to add a rule to only set it if ${BuildDir} does not exist:

        <setInstallerVariable>
            <name>BuildDir</name>
            <persist>1</persist>
            <value>C:\\build2</value>
            <ruleList>
                <fileTest>
                    <condition>not_exists</condition>
                    <path>${BuildDir}</path>
                </fileTest>
            </ruleList>
        </setInstallerVariable>
    

    This will only set BuildDir to default value if --setvars was not specified or did not specify an existing directory.

  • Avatar
    shawn

    Would the samething be true when trying to set the installer version from the command line? What i see when i set the version from the command line is that the installer that is built is the correct version but when i look at the installer project xml shows the value that was already inside. IE: if the version listed in the project file is 15 and i set the version from command line to 18. When i check the project file it will still contain the version 15.

Please sign in to leave a comment.