Fail to set property in MSI

Any SharpSetup related discussions are welcome here including but not limited to questions about functionality, suggestions for improvements and technical questions.
Dis
Posts: 3
Joined: Thu May 05, 2011 8:13 am

Fail to set property in MSI

Postby Dis » Thu May 05, 2011 9:43 am

Hi,

I have a code in my custom step (second one after welcome step) like this:
MsiConnection.Instance.SetProperty("myprop", "hi");

But this property is not saved to the MSI. I've checked it by opening MSI file by ORCA right after setting property. And by result of installation (this property is used during installation). Property can be loaded via GetProperty without any problem.

Also there is no any log even if EnableLogging = true.

What can be a problem?

System: Win 2008R2 x64, VS2010 Premium SP1, SharpSetup 1.4.1 (also tried 1.4)

Thank you in advance.

tomasz_grobelny
Posts: 463
Joined: Sat May 22, 2010 1:26 pm

Re: Fail to set property in MSI

Postby tomasz_grobelny » Thu May 05, 2011 2:58 pm

This is correct behaviour. The SetProperty method sets value of the property only for installer runtime. No methods provided by SharpSetup are meant to modify msi database on disk (except during build time when SharpSetup build scripts uses msidb to embed language transforms).
But what is your use case? Maybe if you are trying to save value between installation and uninstallation then the option is to save value to the registry?

Dis
Posts: 3
Joined: Thu May 05, 2011 8:13 am

Re: Fail to set property in MSI

Postby Dis » Thu May 05, 2011 4:25 pm

Tomasz,

Thank you for quick reply!

My use case is followed: I have custom step where user can set URL to web service. I whould like to pass this URL to the MSI package that will put this URL to the web.config of installed web application. Is it possible to pass some customer information to the MSI to use it in WiX code?

tomasz_grobelny
Posts: 463
Joined: Sat May 22, 2010 1:26 pm

Re: Fail to set property in MSI

Postby tomasz_grobelny » Thu May 05, 2011 4:32 pm

Yes, that should be possible. And SetProperty is the right way to do it. But it is not written to MSI database.
You may try to change name for your property so that all letters are uppercase (MSI public properties have to be uppercase). Also make sure that the property is defined in your WiX source. If that doesn't fix your problem then please post a WiX code fragment where you try to use the property.

Dis
Posts: 3
Joined: Thu May 05, 2011 8:13 am

Re: Fail to set property in MSI

Postby Dis » Thu May 05, 2011 4:41 pm

It works with upper case.
Thank you, Tomasz.

I really enjoy using SharpSetup! Excellent approach used here.


Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest