Search code examples
c#visual-studio-2008setup-projectsetup-deployment

Visual Studio Setup Deployment Project - How to Specify File System Installation Folder


How do I specify Default Location of where my Product is to be installed and create additional folders for Log Files, Temporary Files?

For instance, if I decide to install every instance of my application in the path

C:\Documents and Settings\\Application Data\ is where I want to install my Application, that is, the DLL's, Executables all need to be there.

C:\Documents and Settings\\Application Data\\LogFiles is where I want to write the Log Files.

C:\Documents and Settings\\Application Data\\Temporary Files is where I want to write the Temporary Files that my program will generate (and delete thereafter)

So, I want my Setup to create the main folder and the sub-folders.

In addition, I want to write my AppName.exe.config in a way, that it points to the above created sub-folders.

How do I achieve the same.

My Environment Details:

Visual Studio 2008 C#


Solution

  • These are not appropriate paths. Your app needs to go into c:\program files\manufacturer\productname. Your temporary files need to go into Path.GetTempPath so that they'll get cleaned-up when your app crashes and forgets to clean up the temporary files. Find the directory at runtime. Your log files need to go into c:\documents and settings\username\application data\ folder. Find the directory at runtime with Environment.GetFolderPath(). Don't store paths in app.exe.config

    This ensures your app will install and run on any Windows version.