views:

16

answers:

1

Hello...I have built a C#.NET WinForms App. I now need to build a MSI installer for the same so that I can ship it to my clients.

I am stuck at the following place.

  1. I use log4net for Logging. How do I write my App.Config in such a way that the LogFile folder is based on where my end user installs the Application. That is, if my end user installs it on the Default Location of C:\Program Files\\, then the LogFile folder will be C:\Program Files\\*LogFiles*.

If they chose to install it elsewhere, the LogFiles folder will be a sub-folder of the MyApp folder.

  1. Similarly, I have a TemporaryFiles Folder where I store the temporary files while I am modifying the original files. This again should be a sub-folder of the MyApp Folder.

I also understand that the Application Folder points to the [ProgramFilesFolder][Manufacturer][ProductName], where does the CommonFiles folder point to? And typically what goes inside that?

I use VS2008 for Building the Setup.

+2  A: 

I would simply not have the log files in the program files folder. The process needs write permissions on it and generally you would only want administrators to have write permissions on the program files folder or any of its subfolders. I would rather consider using e.g. %appdata%/yourapplication/logfiles. Then you could easily have your log4net config point to that location, regardless of where this will be set up. I would do the same thing for the temporary files.

(I don't have an answer to that CommonFiles question.)

steinar
@steinar: Thanks for this. But, can you give a sample entry in an App.Config file. Do I just do this <add key="LogFileLocation" value="%appdata%/yourapplication/logfiles" />. Somehow, that does not seem to work for me.
Kanini
Never mind...did a bit of Google in SO, and found out this. <file value="${APPDATA}\log-file.txt" />
Kanini