This is a mirror of official site: http://jasper-net.blogspot.com/

Where Should I Store my Data and Configuration Files if I Target Multiple OS Versions ?

| Sunday, March 21, 2010

Over the past few releases of Windows, you may have noticed common folder locations have moved around a bit.  What should you do if you want your code to target multiple OS’s? Perhaps you are updating an application from XP to Windows 7 and wondering where those old directories went. Hopefully, this post will answer those questions and help you design your application to continue to work with future OS releases.

What’s the Recommended Location for Application Files?

Where to store application files depends on how that data is used by the application and the user. Here is a table to outline the recommended locations for user documents and configuration data.  I’ve mapped the locations across OS’s in this giant table for comparison.

Type of Data Example Windows 7 Vista XP Environment Variable Known Folder ID /
System.Environment.SpecialFolder /
CSIDL
Per user configuration files synchronized across domain joined machines via Active Directory Roaming MyAppSettings.xml %USERPROFILE%\AppData\Roaming \<MyCompany>\<MyApp> %USERPROFILE%\AppData\Roaming
\<MyCompany>\<MyApp>
%USERPROFILE%\Application Data
\<MyCompany>\<MyApp>
%APPDATA% FOLDERID_RoamingAppData
System.Environment.SpecialFolder.ApplicationData
CSIDL_APPDATA
Local Per user configuration files. Files remain local to the machine. MyMachineSpecificData.xml %USERPROFILE%\AppData\Local
\<MyCompany>\<MyApp>
%USERPROFILE%\AppData\Local
\<MyCompany>\<MyApp>
%USERPROFILE%\Local Settings
\Application Data
\<MyCompany>\<MyApp>
%LOCALAPPDATA%

Note: Does not exist on XP

FOLDERID_LocalAppData
System.Environment.SpecialFolder.LocalApplicationData
CSIDL_LOCAL_APPDATA
Per machine Configuration data AppConfigDatabase.xml %SystemDrive%\ProgramData
\MyCompany\MyApp
%SystemDrive%\ProgramData
\MyCompany\MyApp
%SystemDrive%\Documents and Settings\All Users\Application Data Vista/Win7: %PROGRAMDATA%

XP: %ALLUSERSPROFILE%

FOLDERID_ProgramData
System.Environment.SpecialFolder.CommonApplicationData
CSIDL_COMMON_APPDATA
(more..)

Read more: Pat's Application Compatibility Blog

Posted via email from jasper22's posterous

0 comments: