views:

68

answers:

1

I'm using log4net with a VisualStudio WinForms app, and I need log4net to find its config file. (I must keep the config settings in a separate file.)

It works if the config file is in the directory with the executable, but how do I get it there? For now I've added a post-build action:

copy "$(ProjectDir)test.log4net.xml" "$(TargetDir)"

But isn't there a better way? For such a simple task this seems like an awful kludge.

It's only a problem in development, because at deployment I can install the file with the executable. I'm using VS 2010, if that matters.

+4  A: 

I "include" the configuration file so that it's visible in the Solution Explorer, and then in the file's properties in Visual Studio, set "Copy to Output Directory" = "Copy Always".

Mafu Josh
This way and the OP's way end up doing the same thing, just one uses built-in functionality.
cofiem
Built-in is better...thanks!
egrunin