When upgrading my InstallBuilder version I recieve a "Attribute value can only contain alphanumeric or '_' characters" error

Answered

Comments

1 comment

  • Avatar
    Jake

    Starting with InstallBuilder 4.3.0 we implemented a restriction on the possible values for <value> tags inside <option> elements. This affects optionLists inside <choiceParameter> elements and <addChoiceOptions> actions.

    The change was prompted as part of an effort to validate the project XML to catch mistakes at build time rather than at installation time. In the case of choice options, the idea was to prevent empty values, values with spaces or values with invalid characters, such as "(" that could interfere with some InstallBuilder constructs when referencing variables.

    If you use variables that may contain non alphanumeric characters as the value for a option in a choiceParameter, your project files may be affected by this change. Below you can find an example of a code that would give the "Attribute value can only contain alphanumeric or '_' characters" error.

    <addChoiceOptions>
        <name>selection</name>
        <optionList>
            <option text="${non_alphanumeric_value_1}" value="${non_alphanumeric_value_1}" />
        </optionList>
    </addChoiceOptions>
    

    In this case the simplest solution will be to substitute the variable used in the value attribute by a fixed valid value. In most cases this change would not affect the implementation logic of your installer.

    <addChoiceOptions>
        <name>selection</name>
        <optionList>
            <option text="${non_alphanumeric_value_1}" value="choice1" />
        </optionList>
    </addChoiceOptions>
    

    Then, if you want to recover the text of the selected entry (not the actual selected value) you could use:

    ${selection.text}
    

Please sign in to leave a comment.