简体   繁体   中英

Copying directory structure using wix

So I have a huge file structure which I want the installer, I am building using wix, to copy on the client location. Currently I am typing it out like:

<Directory Id="xyz" Name = "abc FileSource = "sdfsdf">
    <Component Id="asdas" Guid="asdasd">
        <File Id = "asdfgrs" Name="name" />
    </Component>
</Directory>

As the number of files have increased I would like this to be done in an automated way. Using heat I am able to generate:

<ComponentGroup Id="weqw">
   <Component Id="2132312" Directory="Some random string (cause of concern>" Guid="asdasd">
        <File Id="sdqwdqwd> keyPath="yes" Source = "Correct source path" />
    </Component>
<ComponentGroup>

My concern is that due to the presence of some random string in Directory field of Component generated by heat, I wont get the directory structure replicated. Is this true? Is there a way around this?

From the heat /? output:

-dr      directory reference to root directories (cannot contains spaces 
         e.g. -dr MyAppDirRef)

If you use heat to recursively harvest a directory structure, then the -dr switch will set the ID of the root target folder. This ID should match the ID of a Directory element you have specified elsewhere in your wxs files.

For the harvested subfolders, heat will still generate a random ID. A given ID will appear multiple times in the generated XML file:

  1. In the Directory element generated by heat for that subfolder, as the Id attribute.

  2. In the Component elements associated with that folder, As the Directory attribute.

The ID is only used to link Component elements to Directory elements. It is not the folder name as it appears after installation. It is only used as a key in the Windows Installer database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM