25

I am using a Windows Installer deployment project in VS 2010 to create an installer for a small demo project. The demo needs to install a SQL Compact database file (MyData.sdf). The demo can't install the database to the application folder on the user's machine--I get an "access denied" error if I do that. So, the logical place to install the database would seem to be a subfolder under the user's c:\ProgramData folder.

How do I specify the c:\ProgramData folder in the deployment project's File System Editor? I right-click the File System on Target Machine node and hover over Add Special Folder to see the fly-out list of special folders, but I don't see a special folder that looks like it corresponds to the c:\ProgramData folder.

Does one of the entries on the list correspond to the folder? Do I have to set it up as a custom folder? If I do, how would I set up the custom folder? Thanks for your help.

David Veeneman
  • 18,912
  • 32
  • 122
  • 187

1 Answers1

45

I don't think it's available in the fly-out. You can create Custom Folder and set its DefaultLocation property to [CommonAppDataFolder].

spender
  • 117,338
  • 33
  • 229
  • 351
  • Also, this question I asked a while back may be of interest: http://stackoverflow.com/questions/215471/locating-installer-paths-in-c – spender Sep 16 '10 at 17:32
  • 4
    Here's the MSDN page describing this: https://msdn.microsoft.com/en-us/library/vstudio/716bxh4e(v=vs.100).aspx – kjbartel Oct 16 '15 at 01:32
  • @kjbartel your link is dead. – Skyqula Jun 14 '17 at 12:12
  • 1
    @spender I am using Visual Studio 2017 for an installer and I can't see [CommonAppDataFolder] in DefaultLocation option. What would be the equivalent option in Visual Studio 2017 installer? – Simant Oct 03 '18 at 08:25
  • 1
    I created a custom folder (like what spender suggests) and manually typed `[CommonAppDataFolder]` in the `DefaultLocation` area. I'm using VS 2019, if that matters. – jordanz Apr 01 '22 at 18:42
  • Thank and don't forget to set AlwaysCreate to true for the subfolder – Rachid Benbrik Aug 23 '22 at 14:23