CPack + Wix + WixFirewallExtension - can I add a new xmlns to the filex.wxs file?


I’m rather new at using CPack, so please bear with me.

I have a project for which I use CPack and Wix to create an msi. I need to add a firewall exception for the installed executable, but I get this error in wix.log:

files.wxs(23) : error CNDL0104 : Not a valid source file; detail: 'fire' is an undeclared prefix. Line 23, position 22. 

I think the solution would be to add the xmlns:fire=“ attribute to the Wix element in files.wxs, but I don’t know if that is even possible.

Here’s what I have right now:

  • In my CMakeLists.txt I added the extension and the patch file:

    set(CPACK_WIX_EXTENSIONS "WixFirewallExtension")
  • In patch.xml I added the following:

    <CPackWiXFragment Id="CM_FP_myapp.exe">
      <fire:FirewallException Id="FWX1" Name="My App" Scope="any" />
  • The generated files.wxs looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="">
        <DirectoryRef Id="INSTALL_ROOT">
          <Component Id="CM_CP_myapp.exe" Guid="*">
            <File Id="CM_FP_myapp.exe" Source="D:/myapp/build/_CPack_Packages/win64/WIX/myapp-3.1.0-win64/myapp.exe" KeyPath="yes">
              <fire:FirewallException Id="FWX1" Name="My App" Scope="any"/>

The error in wix.log states that ‘fire’ is an undeclared prefix, which I think would be solved by adding the appropriate xmlns attribute. Can that be done?

Thank you for taking the time to help me!


1 Like

Just use xmlns:fire into fire:FirewallException
like this

<CPackWiXFragment Id="CM_FP_myapp.exe">
    <fire:FirewallException xmlns:fire="" Id="FWX1" Name="My App" Scope="any" />

Thanks for the answer, but I gave up on using CPack, as it didn’t seem to be all that useful in my case. I ended up just manually creating the .wixproj and then using include_external_msproject in CMakeLists.txt.