i'm encountering this issue with only
c# Environment.SetEnvironmentVariable(key,val, EnvironmentVariableTarget.Process) does not seem to set values that can be retrieved on the native-C app using getenv()
native-C app getenv() can read the values OK using Win2016 + VS-redist-2010
This works fine in Windows Server 2012 and 2008 using VS-redist-2015
Any thought / suggestion will be appreciated.
By default Environment.SetEnvironmentVariable(string <variable>, string <value>) stores variables for the current process. To be more sure you need to use the overload that contains the target Environment.SetEnvironmentVariable(string <variable>, string <value>, EnvironmentVariableTarget <target>). That way you can set the target to Machine or User.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With