Leaving a file after uninstall: how to set Permanent="yes" attribute on component?

Mar 23, 2015 at 3:43 PM
I need to set the attribute Permanent="yes" for a file, so it will NOT be removed after uninstall.
But the attribute is on Component, e.g. from wix example:
<Component Id="LicenseDoc" Guid="*" Permanent="yes">
    <File Id ="License.rtf" Source="$(var.SolutionDir)Installer\License.rtf" />
</Component>
Mar 23, 2015 at 11:44 PM
Apparently , not so difficult ...

On the File object set attributes with prefix Component: and the attribute will be added to the Component instead of the File
 Attributes = new Dictionary<string, string> { {"Component:Permanent","yes"} }}
Mar 24, 2015 at 1:30 AM
Or AttributesDefinition = "Component:Permanent=yes"

AttributesDefinition is converted into dictionary at compile time. It is just a syntactic sugar for declaring the dictionary with just a string value.