Visual Studio offers a way to persist user information between sessions. This is done by using the Globals object located on the EnvDTE assembly.
The Globals object allows you to store, retrieve, enumerate and persist user information. So the next time the IDE is open this information is restored.
We can persist information at three different levels:
- VS or IDE
The information is stored in C:\Documents and Settings\<username>\Application Data\Microsoft\Visual Studio\extglobal.dat. These values are persisted each time VS is closed or a Save All operation occurs.
Snippet:
DTE.Globals["PropertyName"] = value;
DTE.Globals.set_VariablePersists("PropertyName", true);
The information is stored in the .sln file. These values are persisted when the solution file is saved.
Snippet:
solution.Globals["PropertyName"] = value;
solution.Globals.set_VariablePersists("PropertyName", true);
The information is stored in the project file. These values are persisted anytime a project is saved.
Snippet:
project.Globals["PropertyName"] = value;
project.Globals.set_VariablePersists("PropertyName", true);
One important thing is that Values to be stored must be strings, they cannot be objects or structures because these files are xml files.
Pablo
I would like to start a new series of posts named What Happens When or WHW for now on.
Basically I will try to explain what happens behind the scenes when we do things inside VS and GAX. I think this is very helpful to understand the internal mechanics of VS and GAX and how things work.
So, the first post on this series is:
WHW we register a guidance package?
Answer:
- The guidance package project is compiled.
- The installer project is compiled and installed using installutil.
- An entry for the guidance package is added to the recipe framework manifest located at C:\Documents and Settings\All Users\Application Data\Microsoft\Recipe Framework\RecipeFramework.xml.
- This entry contains a timestamp that is used by the runtime to check if a guidance package was altered before loading it.
- The following registry entries are created:
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\AutoLoadPackages\<PackageGUID>
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Menus\<PackageName>
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\PseudoFolders\<PackageGUID>
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\TemplateDirs\<PackageGUID>
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Languages\CodeExpansions\<LANGUAGE>\Paths\<PackageName>
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\<PackageGUID>
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\<PackageGUID>
- A devenv / Setup is done to update menus and commandbars defined in the guidance package (this step requires some time to process).
Pablo
The orientation aware control (OAC) December CTP was released by Clarius.
These are the higlights:
- Design multiple UI layouts or skins for a single control or form, graphically and with full Visual Studio designer support.
- Avoid writing rotation/form factor detection code.
- Optimize screen usage by hiding control on lower resolution devices, without coding.
- Familiar developer experience through full integration with .NET Localization: optimize for locale as well as form factor/orientation.
- Zero-impact on performance, on a par with any localized mobile application.
- Support for current and future form factors.
- Multiple platform support: Windows Mobile 2003 SE, Windows CE 5.0, Windows Mobile 5.0
Download it now for free!!!
Pablo