Replies: 2 comments 2 replies
-
I think if you use the |
Beta Was this translation helpful? Give feedback.
-
At the risk of offending, and I'm sorry if I do, this has a certain code smell to it. I've never heard of an installer requiring an environment variable. That sounds like trying to bypass passing properties into the installer. And when you say "it must exist"... where? In per-user? In per-machine? For the process that is running client side or a new process not yet running or for a service already running? If you really want to just get it you can use [%ENVIRONMENTNAME] an AppSearch shouldn't be needed. But beware, you can set a machine wide environment variable and processes started by the Service Control Manger won't get them until you've rebooted. This includes the server side of msiexec that runs during a silent install. MSI is fairly decent about authoring environment variables but I can think of one really huge gap. There's a tiny note in the SDK doco that says MSI doesn't send a WM_SETTINGCHANGE message when a reboot is pending. Personally I think this is nuts but that's the behavior. WiX has some goodness for this. https://learn.microsoft.com/en-us/windows/win32/msi/conditional-statement-syntax https://learn.microsoft.com/en-us/windows/win32/msi/writeenvironmentstrings-action https://wixtoolset.org/docs/v3/customactions/wixsettingchange/ |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a setup project for creating an msi installer. But one of my pre-requisites for the installer is that a specific environment variable should be present in the system. So first I need to check if the environment variable exists. If it does then the installation will proceed, and if not, the environment variable will be automatically created and then the installation will happen.
To implement this I am first using the "RegistrySearch" element to check whether the environment variable is present. This is then followed by a "CustomAction" where I define the value of the environment variable to be created. My question is whether it is right to use a "RegistrySearch" to check for an environment variable? I have found some sources which say it is okay while others say it is inaccurate. Following is my code for reference
Beta Was this translation helpful? Give feedback.
All reactions