7

I want to create a Visual Studio 2010 setup project that deploys some files to a folder where my application can use it from. I want it so, that all users have the same files, and that they also could manipulate them without admin rights.

Thus, "Common Application Data Folder"* as described in this MSDN article, seems fine.

However, in my Visual Studio 2010 setup project I did not find the "Common Application Data Folder" available in the "Add special Folder..." drop down menu.

I have a .NET 4.0 WinForms app and see no reason why this does not show up. The user's common application data folder is available but does not match my intended use.

Thanks for any hints!

Marcel
  • 15,039
  • 20
  • 92
  • 150
  • There is no folder available in a standard Windows install that all users can write to. CADF is read-only. You'll need to create such a folder yourself. A server share is best, users overwriting each others data is never not a problem. – Hans Passant Mar 02 '12 at 13:43
  • @HansPassant: "Environment.SpecialFolder.CommonApplicationData" is writable. I can access it with the Environment.GetFolderPath() call. I use it in my application, and it works well. However, the installer should put some initial content there for my app to use later. – Marcel Mar 02 '12 at 15:13

2 Answers2

9

Visual Studio setup projects do not have a predefined folder for common Application Data. However, you can install files in it like this:

  • add a custom folder and select it
  • in its Properties pane set DefaultLocation to:

[CommonAppDataFolder]
  • in this folder add the files you want installed in common Application Data

During install CommonAppDataFolder will be automatically resolved by Windows Installer.

Cosmin
  • 21,216
  • 5
  • 45
  • 60
7

A more specific solution might be to set the DefaultLocation property to:

[CommonAppDataFolder][Manufacturer]\[ProductName]

Manufacturer and ProductName will be resolved from the values you assign to the corresponding properties of the setup project.

Derek Johnson
  • 927
  • 1
  • 11
  • 15