kmarks2
kmarks2

Reputation: 4875

"User's Application Data Folder"; Is it possible to force between SpecialFolder.ApplicationData and SpecialFolder.LocalApplicationData

I have an application that needs to run at normal privileges. So it gets installed in Environment.SpecialFolder.ProgramFiles, but stores conf/logging/history details in Environment.SpecialFolder.LocalApplicationData.

The problem is that in the Setup/Deploy project, in the File System section I don't get to distinguish between ApplicationData (roaming) or LocalApplicationData, only "User's Application Data Folder," which could be either depending who installs it on what machine.

Is it possible to force "User's Application Data" to be one or the other?

Upvotes: 1

Views: 1786

Answers (2)

FKDev
FKDev

Reputation: 2286

The Setup Project has made a comeback in visual Studio 2015. The following works with VS 2015:

  • In file system view, add a special folder of type 'Custom'.
  • In the properties of this folder, set the following values:
    • Name : Local App data folder
    • AlwaysCreate : True
    • Condition : (leave empty)
    • DefaultLocation : [LocalAppDataFolder]
    • Property : SOMEPROPERTYNAME

The magic happen thanks to DefaultLocation property value: [LocalAppDataFolder].
I suppose any system folder variable as defined in the following link should work: https://msdn.microsoft.com/en-us/library/windows/desktop/aa370905(v=vs.85).aspx#system_folder_properties

Upvotes: 1

Peter Ritchie
Peter Ritchie

Reputation: 35869

MSI does support local application data folder. If you're talking about a Setup and Deployment project, maybe switching to another installer framework like WiX might be in order. (Setup and Deployment no longer exists in Visual Studio 2012 anyway). WiX has a tool called Dark that will convert an MSI to WiX XML files so you can simply edit them or add to them quickly and easily.

Upvotes: 1

Related Questions