C# – How to put files in the user’s local application data folder in a setup project

cvisual-studio-2008

I'm working with a visual studio 2008 – You get access to a number of special folders to use if you want to include files within. One I don't see on the list is the user's local application data folder. Is there anyway to put files in that folder from within a VS2008 setup project?

Best Answer

When I was facing similar challenge, I made it so:

  • Created a class library auxiliary project.

  • Added the System.Configuration.Install.dll reference.

  • Added a new class inheriting from System.Configuration.Install.Installer

  • Wrote an override of the Install method to copy the files

In the Setup project, targeted the above mentioned project output to the Application folder and -

In Custom actions (Install group) picked the auxiliary project output from the Application folder.