views:

13

answers:

1

We have an MSI we have authored in WiX 3.5.2030.0 and targeting Windows Installer 4.0 (for MSIUSEREALADMINDETECTION support). We have a property that we have defined in the MSI to enforce use of a bootstrapper (I say "enforce" but it's really "very strongly encourage" of course):

<Property Id="SETUPEXE"
          Secure="yes" />
<Condition Message="You must run the MSI through the setup program; you cannot run it directly.">
  SETUPEXE = 1
</Condition>

When we run the produced MSI as a new install, everything works. When we run it as an upgrade, however, the property passed in to the installer seems to be "lost" at some point. The log shows the following relevant entries:

MSI (s) (2C:8C) [11:27:41:648]: Command Line: SETUPEXE=1 <other properties>

MSI (s) (2C:8C) [11:27:43:055]: PROPERTY CHANGE: Adding SETUPEXE property. Its value is '1'.

MSI (s) (2C:CC) [11:28:11:038]: PROPERTY CHANGE: Adding NETFRAMEWORK20INSTALLROOTDIR property. Its value is 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\'.
Action ended 11:28:11: AppSearch. Return value 1.
MSI (s) (2C:CC) [11:28:11:147]: Doing action: LaunchConditions
Action start 11:28:11: LaunchConditions.
MSI (s) (2C:CC) [11:28:33:662]: Product: <product> -- You must run the MSI through the setup program; you cannot run it directly.

Action ended 11:28:33: LaunchConditions. Return value 3.
Action ended 11:28:33: INSTALL. Return value 3.

Property(N): SETUPEXE = 0

Property(N): SecureCustomProperties = NETFRAMEWORK20INSTALLROOTDIR;NETFRAMEWORK35;NETFRAMEWORK35_SP_LEVEL;NEWERVERSIONDETECTED;OLDERVERSIONBEINGUPGRADED;SETUPEXE

Property(S): SecureCustomProperties = NETFRAMEWORK20INSTALLROOTDIR;NETFRAMEWORK35;NETFRAMEWORK35_SP_LEVEL;NEWERVERSIONDETECTED;OLDERVERSIONBEINGUPGRADED;SETUPEXE

Property(S): SETUPEXE = 1

I have done some searching on this and looked at the log in WiLogUtl and have at least figured out that Property(N) indicates a "nested" property, but I don't know what the nesting is when I'm running the MSI directly through msiexec. Then, I don't know why the nested property is not set correctly when the client and server values are correct. How do I resolve this?

A: 

I'd consider changing that condition to ( or similar depending on your use case )

<Condition Message="Blah blah blah">SETUPEXE or Installed</Condition> 

I do a similar thing ( InstallShield setup.exe passes a SETUPEXEDIR property by default ) and it's not a horrible thing to do if you want to make sure your installer was run through the bootstrapper to ensure prereqs had a chance to be installed. But for maintenance / repair / uninstall scenarios you probably don't want to require the setup.exe to be run.

Christopher Painter
I was just about to post this when you beat me to it - I figured this out. I actually was using REMOVE="ALL" in my fix but Installed is probably a safer choice.
MikeBaz
You pretty much ALWAYS want to use "or Installed" in your conditions otherwise you get into situations like someone removes .NET and now you can't uninstall or repair your product.
Christopher Painter

related questions