I'm using VS.NET 2003 and VB.NET. I have placed my log4net.config file in the same folder as the source code and I want to automatically copy the log4net.config file to the bin folder just as the app.config file is copied to bin. Is there an automatic way to do this?
A:
Include it as a resource, and choose copy always.
You can do this by:
- Click on your vbproj file and choose "Add Existing item"
- Navigte to the config file and select it
- Right click on the config file and make sure it is not set to "embedded resource" (you dont want it embedded in your exe or dll)
- Make sure its build action is set to "Copy always"
- Build, and check your build directory it should be there
I dont have my IDE open, so the steps might need a little tweaking.
GrayWizardx
2009-12-22 05:19:02
I don't see this option in the VS.NET 2003 IDE.
Raj
2009-12-22 05:34:05
Which option???
GrayWizardx
2009-12-22 05:58:34
The build action has only 4 selections i.e. None,compile,content and Embedded Resource. I don't see the "Copy Always" option that you have suggested.
Raj
2009-12-22 07:34:10
Select "Content".
GrayWizardx
2009-12-22 08:05:55
Thanks for your time GrayWizardx. Unfortunately selecting "Content" still doesn't copy the Log4net.config to the bin folder.
Raj
2009-12-22 08:18:01
Just to clarify for anyone reading: the "Copy always" option is a separate project property that was introduced in VS2005; it doesn't exist in VS2003.
Craig Walker
2010-06-30 16:29:24
A:
Add a post build event - http://geekswithblogs.net/dchestnutt/archive/2006/05/30/80113.aspx
Something like:-
copy "$(ProjectDir)log4net.config" "$(ProjectDir)$(OutDir)"
should do it.
Brian O'Connell
2010-01-03 16:40:13
Unfortunately, VS2003 doesn't support build events, so this won't work.
Craig Walker
2010-06-30 16:41:40