I know it is not supported by default. I tried to workaround it. I calculated the size in the component's "initialization Actions", then name the component like this: "My component (${my_size} MB)". It worked well during installation, but when I uninstall an individual component, it shows ${my_size} part as undefined variable.

I couldn't find a way to set the value of ${my_size} for uninstalling an individual component. Is there a possible way to do that?

Thanks.

asked 08 Jun '12, 21:23

gt8967884's gravatar image

gt8967884
116747678
accept rate: 12%


You can persist the my_size variable, so that it is available in the uninstaller, using the following persist attribute:

<setInstallerVariable name="my_size" value="${calculated_size}" persist="1"/>

But, I believe that you missed the requiredSize attribute for each component. In your installation, you might want to compare something like a calculated_size to a requiredSize to see if you get the same result as the value that is set at build time.

<setInstallerVariable name="each_component">
    <value>component(some_group).component(some_subcomponent)</value>
</setInstallerVariable>
<setInstallerVariable name="calculated_size" value="0"/>
<showInfo>
    <text>The calculated size of ${${each_component}.name} is ${calculated_size}, which is not equal to the required size, ${${each_component}.requiredSize} KB.</text>
    <ruleList>
        <compareValues logic="does_not_equal">
            <value1>${calculated_size}</value1>
            <value2>${${each_component}.requiredSize}</value2>
        </compareValues>
    </ruleList>
</showInfo>
<showInfo>
    <text>The calculated size of ${${each_component}.name} is ${calculated_size}, which is equal to the required size, ${${each_component}.requiredSize} KB.</text>
    <ruleList>
        <compareValues logic="equals">
            <value1>${calculated_size}</value1>
            <value2>${${each_component}.requiredSize}</value2>
        </compareValues>
    </ruleList>
</showInfo>
link

answered 09 Jun '12, 01:05

DevHopeful_2012's gravatar image

DevHopeful_2012
176131521
accept rate: 9%

Oops...just noticed the "for an individual component" part. You can just persist the variables with unique names, such as the individual component names. Then, get their value by constructing the name with the component.name.

(09 Jun '12, 01:09) DevHopeful_2012

Thanks very much. The "persist" trick works very well.

(09 Jun '12, 19:07) gt8967884
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×39
×14

Asked: 08 Jun '12, 21:23

Seen: 1,280 times

Last updated: 09 Jun '12, 19:07