From the Globals.VariablePersists Property documentation:
If the global variable is associated with the Solution object, then the value is saved in the solution (.sln) file. The values are saved any time the environment writes the .sln file.
When the environment is shut down or a Save All occurs, all global values are saved. If VariablePersists[] is associated with the DTE object, the value is saved in the user options directory of the Visual Studio environment.
... In both cases, the data is stored either in the solution (.sln) file or in the structured storage file in the User Profiles directory.
I have successfully used the VariablePersists
property on a Solution.Globals
object and it saved to the solution (.sln) file as described. I did the same with the DTE.Globals
, but I couldn't find the actual storage location.
The closest I've found is a CurrentSettings.vssettings
file in %LOCALAPPDATA%\Microsoft\VisualStudio\16.0_50f510cf\Settings
, but I had no result searching for the persisted variables (name or value) within the file.
I've also looked in the following directories (and their relative sub-directories) hoping to find this "user options directory" or "User Profiles directory" as mentioned in the documentation:
%USERPROFILE%\Documents\Visual Studio 2019
%APPDATA%\Microsoft\VisualStudio
%LOCALAPPDATA%\Microsoft\VisualStudio
What is this structured storage file and where can it be found (I'm using Visual Studio 2019)?