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.
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".
精彩评论