Akshay J
Akshay J

Reputation: 5458

Programmatically create InstallShield packages

I have been searching on the internet for ways to create InstallShield setups using c#. I came to know that there is one " InstallShield Automation Library" available for it. But, all the examples I have seen so far only automate the task of building projects already created.

InstallShield Automation Using c#

However what I need is this:

  1. I would first create an InstallShield project (.ISM) manually specifying details such as folder structure etc
  2. Then, I want to create a program that will copy the ISM file with the new version name, add files to the newly created project file and then build it.

Please let me know if its possible and how to proceed.

EDIT: I just came to know that the directories created during installation are called features. So the question may be read as "How to add feature to project file and add files to that feature"

EDIT2 I have found a way of iterating it here:
http://blogs.flexerasoftware.com/installtalk/2010/12/getting-started-with-installshield-automation-and-c.html
Maybe this can help someone prepare the answer.

Upvotes: 2

Views: 4074

Answers (1)

Jag
Jag

Reputation: 141

In simplest terms, in MSI world, a file belongs to a component. And the file will be installed if the feature associated with the component is installed.

So, your task would be to create a component, add the file to it and associate it with a feature.

  1. Create ISWiProject object (say proj).
  2. Call proj.OpenProject and open the existing project.
  3. Call proj.AddComponent and receive ISWiComponent object (say comp).
  4. Set the component's destination folder(using comp.Destination property).
  5. Call comp.AddFile to specify the source location of the file.
  6. Associate the component to an existing feature. For instance, if you have a feature with name feature1, use the following: proj.ISWiFeatures.Item("feature1").AttachComponent(comp)
  7. Use proj.ProductVersion to change the installer version as per your needs.

There's a whole lot of things that you can do via the Automation interface. See the documentation here: http://helpnet.installshield.com/installshield16helplib/IHelpAutoISWiProject.htm

--Jag

Upvotes: 3

Related Questions