The Fragment element
Up to this point, we've been adding all of our WiX elements to the Product.wxs
file. When your installer packages hundreds of files, you'll find that having all of your code in one place makes reading it difficult. You can split your elements up into multiple .wxs
files for better organization and readability. Whereas your main source file, Product.wxs
, nests everything inside a Product
element, your additional .wxs
files will use Fragment
elements as their roots.
The Fragment
element doesn't need any attributes. It's simply a container. You can place just about anything inside of it, such as all of your Directory
elements or all of your Component
elements. For the next example, add a new WiX source file to your project and place the following markup inside it. Here, we're using the same ComponentGroup
that we discussed earlier. You can call the file Components.wxs
, and it should look something like the following code snippet:
<?xml version="1.0" encoding="UTF-8"?>...