Search code examples
c#wixwindows-installercustom-action

Change installation location of .msi using Wix or custom action


I have built an installer using Wix but whenever I run it the files get installed in Program files on C drive. I want few of files say a, b, c to be installed in Program Data folder and few d, e, f in D:\x\y folder. Please help me. How should I write custom action and call it.


Solution

  • Yogesh you misunderstand how MSI works. Files that target C:\Program Files\AppFolder should be placed in their own component. Files that target C:\Program Data\CompanyName\AppName should be in their own component.

    Each component has a target directory.

    Also when adding files to components you must follow component rules where you cannot have multiple chm, exe, dll, ocx, etc files within a single component. You must add multiple components of each unique file of these types. You can associate other files with one of these, for example let's say you have your app.exe file in its own 'app.exe' component, you can add an associated .config file or .xml file to this component as well.

    You DO NOT need a custom action to copy files to C:\Program Data\CompanyName\AppName folder.