Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I to include all files from source folder and deploy them into a target folder during installation. I have multiple images in a folder and i want all of them to be included in msi automatically rather than including all of them separately using
XML
<file>
element. I am able to include required dlls and files using

XML
<Component Id='HelperLibrary'>
        <File Id='HelperDLL' Name='Helper.dll' />
</Component>


Any help will be appreciated.
Posted
Updated 12-Dec-13 19:45pm
v2

1 solution

To best of my knowledge, there is no such feature in the Wix project schema. All files should be explicitly listed.

The WiX approach is different. It has the concept of "harvesting" of the data from directories, sites and other sources. This is done through the utility called "heat": http://wixtoolset.org/documentation/manual/v3/overview/heat.html[^].

Now, if this file, "Helper.dll", is your own component with source code, you should do completely different thing. You should include this project in the same solution as your WiX project and reference the "Helper" project by your WiX project using the usual "Add Reference". Then you can reference this file indirectly, by the name of the project, thus abstracting from the location and name of the DLL or EXE file. For example:
XML
<Component Id="Assemblies" Guid="... some GUID ...">
    <File Source="$(var.Product.TargetPath)" Id="entryPointAssembly"/>
    <File Source="$(var.Help.TargetPath)" Id="Help.dll"/>
    <File Source="$(var.Library.TargetPath)" Id="someLibrary.dll"/>
</Component>


Here, "Product", "Help" and "Library" are the names of the projects of the solution referenced by your WiX project. You should add project references using the tab "Projects" of the "Add Reference" window. Likewise, you can reference the output directory of the referenced projects and other attributes referenced here:
http://wixtoolset.org/documentation/manual/v3/votive/votive_project_references.html[^].

—SA
 
Share this answer
 
v4
Comments
Badrul Muneer 13-Dec-13 2:18am    
Thanks Sergey, actually I have a folder which contains necessary images and icons and I want to add that whole folder to MSI, if I have not understood wrongly do I need to manually add all the files using <file> element?
Sergey Alexandrovich Kryukov 13-Dec-13 2:27am    
Either manually or using harvesting with "heat.exe". As far I as remember, when I did it, there wasn't a way to simply embed heat in a MSBuild WiX project (there wasn't such MSBuild Task assembly), so you could run heat manually or with pre-build step, to generate list of files automatically. I personally simply created a batch file and text processor, as I had many files, but few directories.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900