Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Automation Interface get property by name (C#)


Best Answer installer96 , 11 July 2017 - 16:53

Thanks.

 

This was the right syntax.

 

Project.ISWIProperties["ALLUSERS"];

 

I had just forgotten to open the project first.

Go to the full post


2 replies to this topic

installer96

installer96
  • Full Members
  • 37 posts

Posted 10 July 2017 - 22:33

I'm trying to use the automation interface to get or set a property by its name.

 

All the documentation and most of the examples online are in VB so I'm struggling with the syntax.

 

Attempting to do it like the documentation says results in errors.

Project.ISWIProperties.Item("ALLUSERS"); // Says definition for Item doesn't exist

Project.ISWIProperties("ALLUSERS"); // Says ISWIProperties can't be accessed like a method

 

 

 

I tried accessing it like this

Project.ISWIProperties["ALLUSERS"]

 

And like this

// Get an InstallShield property by name
private static ISWiProperty GetISProperty(ISWiProject Project, string propertyName)
{
    return Project.ISWIProperties
                .OfType<ISWiProperty>()
                .First(x => x.Name.Equals(propertyName));
}

 

...both resulted in a run-time error. Help?



deramor

deramor
  • Full Members
  • 187 posts

Posted 10 July 2017 - 23:47

This thread has an example but not how to reference the automation dll

https://community.fl...p?t-182873.html



installer96

installer96
  • Full Members
  • 37 posts

Posted 11 July 2017 - 16:53   Best Answer

Thanks.

 

This was the right syntax.

 

Project.ISWIProperties["ALLUSERS"];

 

I had just forgotten to open the project first.