views:

69

answers:

3

I'm using an open source library (log4net) that comes with LICENSE, NOTICE, and README files that are supposed to be included when you distribute it. So I want to make visual studio put them in the output directory along with my binaries.

I have log4net and its three files in a "lib\log4net" dir. The problem is if I add the files as content files, they get copied to bin\release\lib\log4net, not bin\release. Is there any way to make visual studio collapse the paths when building?

I originally used a post-build step to copy them, but then visual studio isn't aware of them and it won't put them in any other dependent project's output folder (which it will do if you call them content).

A: 

All you have to do is right click the file, README, for example, and go to properties. One of the properties is "Copy to output directory". Set it to true.

icemanind
No, this copies it with the full path. I.E. if it is /lib/log4net/READMEit will become/bin/Release/lib/log4net/READMEI want it to become/bin/Release/README
Eggplant Jeff
Just add the files to your solution. It shouldn't add any path to it.
icemanind
That is only true if I add them to the root of my project. I want them to be in a subdirectory of my project but when compiled into bin/Release NOT be in a subdirectory.
Eggplant Jeff
oh I see what you are talking about. Give me a few to research this and I will find a better solution for you
icemanind
+1  A: 

You could use a post-build step on your project and just move them to the directory you want them in. I frequently use pre-build steps to bring in the latest versions of dependencies and post-build steps to arrange my project the way I want to deploy it.

Jason
As I said in the original question, post-build steps do not do what I want. A post-build step works for one project, but if I have another project that references that one, it will need its own post-build step. That gets tedious fast. Including the files as "content" means visual studio WILL put them in other projects' output folders, so the dependent projects can just reference the first project and not have to have a bunch of special post-build steps that don't mean anything to them.
Eggplant Jeff
@Eggplant Jeff: I'm aware of no better way of accomplishing said task. I have 10+ projects using this method to copy an assortment of files to the bin directory. Now, if you cerated an installer this could be done automagically.
sixlettervariables
+1  A: 

If you are using an install project to package everything, what about adding the extra files directly to that instead?

Pedro
I'm not using an install project, but the larger problem is that this is a common helper project used by a bunch of other projects. I don't want to have to add a manual step (of any kind, post-build, a special line in an installer, etc) to ten other projects that happen to use this one... especially since I have more than one helper project like this. The proliferation of manual steps becomes a real mess.
Eggplant Jeff