I would like to use log4net as the logging framework for my addin. However, now I'm having trouble in enabling logging in debug mode and in the released esriAddin file. It works in either one, not both at the same time.
I have a dedicated configuration file for log4net (called log4net.xml). When the Build Action of the file is set to Content
, the logging works in the debug mode but not in the released addin. When Build Action is AddinContent
, it's the opposite.
The reason for this is that when in debug mode, the solution uses the bin folder as the base directory, but when the addin is compiled the folder is the "esriaddin" file.
So when in debug mode and Build Action
=Content" the log4net.xml is at C:\Users\%username%\AppData\Local\ESRI\Desktop10.0\AssemblyCache\{9FFCCA4E-6DD6-81B5-17C3-7683C725F70D}
. When I change Build Action to "Addin Content" (while still in debug mode), the log4net.xml is not copied to the directory!
My problem is how can I configure my solution so that the log4net config file would be in a static location regardless of the Build Action? I need to do this because I want to automate the building process and changing the Build Action manually is not an option.
I've checked this thread but its solution is to edit the ArcMap.exe.config
file which is not an option for me (many users for the addin, the file may not be empty).
Any suggestions?