简体   繁体   中英

Give a random ID to a File element in WiX

As mentioned in the element's documentation , the default value for the ID attribute is the file name portion from the Source attribute.

The problem occurs when we add multiple files with the same name (but different locations), thus the ID attributes that should be unique become a duplication.

Is there an easy way to give the attribute a random identifier (something like the asterisk in the GUID of the Product element)?

I want not to set the identifiers manually since the files with the same name increase and spread in many .wxs files all over the project.

How about the option of making a WiX extension for that? Something like a function call to get random values.

Thank you!

In WiX Toolset v3.7, the Ids get automatically generated. This will work most of the time (still an issue when 2 filenames are similar eg when the only difference is a blank in one file and an '_' at the same position within the filename in the other)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM