Camille Colvray
Camille Colvray

Reputation: 420

How can i get the product version of InstallShield Project from my main project in C#

In my soltuion VS, I have an project in C# and an InstallShield project.

I would like get the product Version of InstallShield :

enter image description here

But from my C# project like this :

string Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

But it's the Assembly version and not product version of installshield.

Can use new reference COM : InstallShield 22 Automation Interface

with this code

var ISObject = new ISWiAuto22.ISWiProject();
ISObject.OpenProject(@strPath);
var version = ISObject.ProductVersion;

But with a InstallShield Limtied Edition we can't do this. For use OpenProject, the project file have to be .ism and mine is .isl, so i get an error : * This project was created using a previous version of InstallShield Developer, InstallShield - Windows Installer or InstallShield Express.*

Upvotes: 1

Views: 1498

Answers (1)

Andrei
Andrei

Reputation: 98

You can use COM-interface of InstallShield to parsing IS project file.

VBS example:

Public Sub UpdateInstallerProductCode(strPath, strProductCode)
Dim objISWiProject

' Load InstallShield project
Set objISWiProject = CreateObject("ISWiAuto19.ISWiProject")
objISWiProject.OpenProject strPath

' Set new product code
objISWiProject.ProductCode = "{" & strProductCode & "}"

' Save and close InstallShield project
objISWiProject.SaveProject
objISWiProject.CloseProject
Set objISWiProject = Nothing
End Sub

I hate VB/S :))

Upvotes: 1

Related Questions