views:

223

answers:

2

Greetings,

I have a custom action inside an MSI installer that makes some changes to some configuration file. my requirement is to run the installation in silent mode so I am using msiexec. Here is the command:

msiexec /i myInstaller.msi /l* out.txt myContextParameter=value1

myContextParameter is never passed to the custom action so when I do context.Parameters["myContextParameter"] I get a null value

When I run my MSI in UI mode the parameter is passed correctly. I also made sure the name of the property is correctly set in the CustomActionData

Any ideas,

Thanks a lot

A: 

If you want to be able to pass parameters from the outside you need to use ALLCAPS in your parameter names. I know it sounds weird, but try it! :-)

klausbyskov
you mean call it like this: msiexec /i myInstaller.msi /l* out.txt MYCONTEXTPARAMETER=value1
I just tried allcaps and it didn't work
Yes that's it. Did you remember to change `context.Parameters["MYCONTEXTPARAMETER"]` aswell?
klausbyskov
Yeah the Context.Parameters does not contain anything!
A: 

MixedCase properties are "private" and will not be passed in from the command line.

ALLCAPS properties are "public" and can be passed in on the command line.

However only secure public properties are passed through to the 'server' (i.e. retained during UAC elevation). See the SecureCustomProperties property documentation.

Assuming you're trying to access this property in a deferred CA, this is happening on the server side so you need to use a public property (all caps) that is also marked as secure.

Here's an example using WiX:

<Property Id="MYPUBLICPROPERTY" Secure="yes" Value="{}">
sascha
Thank you for your reponse, can you please share any example of how the CA public property should be declared.many thanks
Yeah but I am not using Wix
Well, what are you are using then?
sascha

related questions