views:

26

answers:

1

Hello...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#

+1  A: 

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.

Hans Passant
@Hans Passant: Thanks! Any particular reason as to why I should not use the App.exe.config for storing paths? Also, if I have to set the Log Folder at a path Environment.GetFolderPath(), how will I set it using log4net? Apologise that I have not included that in the question. Will update it right away.
Kanini
Please don't change your question. I gave you a proper answer on your original one. Start a new question about log4net.
Hans Passant
@Hans Passant: Apologies. I updated the question before reading your comment. I have rolledback to the original question. But, can you still provide me with some info on why App.exe.config shoud NOT be used for this?
Kanini