# How to generate a one-cabfile-per-component package when using CPack+WIX

**URL:** https://discourse.cmake.org/t/how-to-generate-a-one-cabfile-per-component-package-when-using-cpack-wix/4085
**Category:** Usage
**Created:** [September 14, 2021, 7:18am UTC](https://discourse.cmake.org/t/how-to-generate-a-one-cabfile-per-component-package-when-using-cpack-wix/4085 "2021-09-14T07:18:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![joy365](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/4da419/32.png) [@joy365](https://discourse.cmake.org/u/joy365)
#### Post date: [September 14, 2021, 7:18am UTC](https://discourse.cmake.org/t/how-to-generate-a-one-cabfile-per-component-package-when-using-cpack-wix/4085/1 "2021-09-14T07:18:55Z")

</div>

Now I am trying packaging my project by using CPack+WIX, and I need to split my files into multiple cab files.

I know that after adding these elements:

```auto
  <Media Id="2" Cabinet="media2.cab" EmbedCab="no"/>
  <Media Id="3" Cabinet="media3.cab" EmbedCab="no"/>
  <Media Id="4" Cabinet="media4.cab" EmbedCab="no"/>

```

into main.wxs by setting the CPACK\_WIX\_PATCH\_FILE, I can get a xxx.msi with 3 cab files. But the cab files contain no file because it is also needed to add the attribute  
“DiskId=num” into each File element or Component element in the files.wxs. However, I have thousands of files to be packed so it’s hardly possible to achieve this by writing the content into the CPACK\_WIX\_PATCH\_FILE again.

So, is there any method that the CPack can generate the package which is composed of a .msi file and multiple .cab files, each cab file named after an install-component and containing all the files belonging to the same install-component?
