Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is AppData now the 'correct' place to install user-specific apps (which modify their own data)?

I'm probably just being very thick here, but it's not clear to me where I'm supposed to install 'new' user-specific programs on Windows 7 (and presumably Vista too, though I've not specifically looked at that scenario yet).

Under Windows XP (rightly or wrongly) we always installed our programs into folders under 'Program Files' and accepted that they'd be kind-of available to everyone. From what I can gather under Windows 7 I'm supposed to install my software under the user's AppData folder (possibly AppData\Local\MyApp). That makes a degree of sense, but the fact that this folder is 'hidden' by default means that we're going to have 'fun' talking our users through support stuff.

I want to install our software so that it's user specific (the Users bit in Windows 7 makes perfect sense) but I do want the user to be able to access it if required. Our program also includes a 'data' subdirectory which it needs to write into while it's running (embedded database), but as the program is intended to be single-user/standalone, the data folder being inside a user-specific folder isn't going to be a problem.

My problem is just that whole 'hidden folder' aspect of AppData. As much as I've trawled the MSDN, I can't work out where else I'm supposed to install user-specific programs. Taken one way it would seem to be something like AppData\Local\MyApp, and another way it would seem to be just as valid under the user's My Documents\MyApp equivalent.

Has anyone got a clear guide for where all this stuff goes? I found the MSDN docs confusing. :-)

like image 835
robsoft Avatar asked Dec 02 '09 09:12

robsoft


People also ask

Should you install to AppData?

You should use AppData for any configuration, or program files that will change with the program.

What is the purpose of AppData?

AppData is a hidden folder located in C:\Users\<username>\AppData. The AppData folder contains custom settings and other information needed by applications. For example, you might find the following in your AppData folder: Web browser bookmarks and cache.

Is AppData the same as application data?

Application Data and AppData are almost the same thing. AppData is the intended location for user-specific data that applications might want to keep.

Why do some apps install in AppData?

The user has to have at least Modify permissions on their AppData folder in order for basic account functionality to work. By installing into AppData/Local these applications get around the requirement to have an administrator or UAC prompt authorise the installation. Google Chrome is a good example of this.


4 Answers

Not really.

The directory that serves as a common repository for application-specific data for the current roaming user.

AppData is, surprisingly, for application data, not for installation (Click Once/Silverlight applications aside). You can, and should still install into Program Files, just don't expect to write into that folder.

You can install software into AppData if you want it to follow a user about in an Active Directory environment, which happens if you put it in AppData\Roaming (the SpecialFolder.ApplicationData location).

You can also install into AppData if you want the software to be available to just the user that installs it. This can be useful if, for example, you have multiple users on the same machine, who all want to run different versions of the software in complete isolation.

If you want settings to only apply on the local machine then you use AppData\Local, which is SpecialFolders.LocalApplicationData - this will make AD administrators very happy as the roaming profile size won't suddenly jump up 50Mb or whatever the size of your software is.

If you wanted to create settings which apply to all users then you're looking at SpecialFolders.CommonApplicationData

You should remember never to rely on the actual name of the directory - localisation issues mean this can change and the location does change with OS versions two. You should be using the special folder enumeration in your software, or the equivalent in your installer.

Could you not install into Program Files, but use AppData as it's supposed to be used, and store your database in there?

like image 146
blowdart Avatar answered Sep 28 '22 08:09

blowdart


Windows 7 added the FOLDERID_UserProgramFiles known folder and by default this maps to %LOCALAPPDATA%\Programs. This is used by MSI when ALLUSERS=2 & MSIINSTALLPERUSER=1.

On Vista and earlier there is no canonical per-user application folder but just using %LOCALAPPDATA% is pretty common. Sadly MSI will just use %ProgramFiles% on these systems.

like image 38
Anders Avatar answered Sep 28 '22 10:09

Anders


It's 2019, and I just installed Visual Studio Code (a Microsoft product) in the default folder of

%userprofile%\AppData\Local\Programs\Microsoft VS Code

This is probably for getting around the requirement to have an administrator or UAC prompt authorise the installation

like image 33
Paiman Roointan Avatar answered Sep 28 '22 09:09

Paiman Roointan


Windows 7 folder structure is deeply inspired on Unix structure:

/usr/ -> C:\Program Files\ -> binaries: executables and dynamically linked
/etc/ -> C:\ProgramData\ -> global settings
/home/ -> C:\Users\ -> a folder for each user
~/.* -> C:\Users\Hikari\AppData\Roaming\ -> settings for each user

Windows has more folder, like My Documents for files with content produced by user, AppData Local and Roaming (which Unix usually handles with NFS).

It's about time for us developers to start using these structures. We must separate at least binary files that don't need to be replicated, global and user settings.

When a setup is installing an app, this setup should expect to have permission to write on Program Files. Once the setup is finished, Program Files should be writable only for other setups aiming to update binaries to other versions.

like image 40
Hikari Avatar answered Sep 28 '22 09:09

Hikari