View Full Version : Modifying INI files based on features?

06-16-2006, 05:22 PM
I have a basic MSI install that can be installed on 2 different types of computers that have different settings in an INI file. Basically what I need to do is to set the appropriate comm port depending on the setup type selected.

I thought that if I created 2 features that have the ini file change components associated with each one, then when it was selected, the comm port would be set. That is not happening now. It always sets to Comm1.

So I need some pointers on the correct way to do this. I want to be able to have a dialog that asks the user which type of computer this is being installed on and then set the comm port accordingly.

06-16-2006, 05:40 PM
Your two-features-each-with-a-component-containing-different-INI-data strategy sounds as if it should work; if you create an MSI log file and then run it through Tools > Analyze MSI Log, does it appear that both features or components are being installed for some reason?

06-16-2006, 06:10 PM

I ran the install using /log logfile and I am attaching the analysis. As you can see there is no feature or component states. What logging options do I need to set to be able to see this or would you like to see the log?


06-16-2006, 06:42 PM
Perhaps try msiexec /i productname.msi /L*v everything.log?

Christopher Painter
06-16-2006, 09:18 PM
If I understand your requirements, you don't really need to have 2 features to do this. You possibly don't need to components either.

The setup type has a property associated to it's RadioGroupBox. You can have 2 custom actions that set another property to something like COM1 or COM2. Each custom action has a mutually exclusive condition tied to the property of the RadioGroupBox. This way your property will get set to COM1 or COM2 ( or whatever data you need. )

Now lets assume you have Foo.exe and Foo.ini. Put them both into a component and set Foo.exe to be the KeyFile. Now author INI changes for the component and set it to modify the INI file. ( FileName, DirProperty, Section, Key and use the property you set earlier for the Value column.

This way the change is always associated to the component doing the install but the data for the change is assoicated to the setup type.

BTW consider your conditions for the CA's carefully. You want to make sure that you persist the original values during repair or use a different condition during repair/maintenance UI.

06-19-2006, 11:24 AM

Thanks for your suggestion. I will try it out and respond later.


06-19-2006, 06:10 PM
Chris & Bob

Although I didn't quite follow what you suggested, my install now works. What I did was to set a public property from a new dialog and then use that property to set my ini file setting.

Thanks to you and Bob for your help.