For several files in my product, I need them copied to two distinct destinations upon installation. For example:
C:\Program Files (x86)\My Company\My App\foo\xyzzy.txt
C:\Program Files (x86)\My Company\My App\bar\xyzzy.txt
These two copies of xyzzy.txt are identical.
I'd prefer not to take the size hit of having identical copies of the file in the cabinet. Playing with makecab, it seems having duplicate copies of files in a cab effectively doubles the size of the cab. By comparison, 7zip manages to include the second copies with almost no cost in size.
Is it possible to have one copy of each file in the (embedded) cabinet and to install it to two different destinations? If so, how would you specify that in WiX 3.5?
I assume that having two File elements with the same Id would run afoul of XML's rules and/or the WiX component rules. On the other hand, if I have unique File elements, will light simply put two copies of the same file in the cabinet?
Yes, WiX 3 does this automatically. Just use the same Source attribute in the different File elements. And, yes, you have to give the File elements different Id attributes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With