Environmental Caution

Our system keeps some slow changing values in environment variables. This works out okay. Normally we only changes these about once a year. Sometimes we need to make changes to some of these environment. I had to do so this week. But I had some troubles. My builds kept using the old values that were set. Then it dawned on me. Visual Studio must be caching the environment variables on load.

So you need to exit Visual Studio and restart it for it to pick up environment variable changes. Perhaps storing state in environment variables is not such a good idea. We could stash this stuff in the registry. Changes in the registry are immediately available to anyone who accesses the registry. We actually use the registry for a bit of run-time values in our app.