0
votes

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?

2
Why does it matter? The admin usually defines the environment which would decide whether a roaming folder would be used--in which case the alternative might be an access violation. - Peter Ritchie
Because I want to force it to LocalApplication data. And I do not have control over what the admins on other networks decide. Also, irrespective of what an admin does, I have to specify local or roaming in my code. - kmarks2
"Because you want to" isn't a reason. The question implies that. What's wrong with ApplicationData? - Peter Ritchie
"Because I want to" = In the cases where domain users are involved I am constrained to not copy (potentially extremely large) application files around the network. Roaming is 100% not an option. - kmarks2
What are you trying to get the setup to do in LocalApplicationData? - Peter Ritchie

2 Answers

1
votes

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.

0
votes

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