Question

i am using wix 3.0.i have a folder name "images".so i want to copy all the files from images into msi package.when i copy all the file and install msi to another PC then it did not bind the images. And when i use simple File Element then the files bind to msi package. so what should i do,

Reply me soon

Thanking You Samir

Was it helpful?

Solution

Apparently you want to create an application that can generate a screensaver installer that includes a number of image files selected by the user — a sort of specialized InstallShield application just for creating screensavers installers.

I would first create a template MSI file (with wix or something else) that does most of the work. You don't know which files the user is going to select later on, so add a placeholder component with the ID "UserSelectedFiles". Distribute this template MSI file with your application.

Then, when the user wants to generate a new installer, start by copying the template. Edit the copied msi so that it also installs the user selected files. You can do this with the .NET classes you can find in the "deployment tools foundation" API. This is a set of assemblies that come with wix; take a look at C:\program files\Windows Installer XML v3\sdk.

I have only used the DTF API for some simple stuff, like this example which counts the File table entries in the MSI:

var database = new Database(@"\path\to\some\file.msi");
var list = database.ExecuteQuery("SELECT FileName FROM File");
Console.WriteLine(list.Count);

Your case will be a bit more complicated. You will probably have to

  • generate a CAB archive that contains the image files with the classes you find in the Microsoft.Deployment.Compression.Cab namespace.
  • merge the CAB archive into the msi with Database.Merge
  • Add new entries to the File table of the MSI
  • Change the product code to something unique for each generated MSI
  • etcetera

To get an idea of the content of an MSI file and how it can be edited, I recommend you first play around a bit with the orca and msidb tools.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top