views:

1281

answers:

1

I have a project that is stored in a Subversion repository.

In this repository, in a different folder, I have a set of libraries that I use in many of my projects. These libraries are stored as binary files, ie. the dll's, pdb's, and xml's.

Here's an example layout:

<repo-url>
    \Libraries
        \SQLite
        \SystemHooks
        \Moq

In the application project, I add a "libs" directory, then add a svn:externals reference property to that directory to pull in the libraries I need.

For instance, for this project I am working on now, which prompted this question, I need the SystemHooks library, so in my app project folder structure, it now looks like this:

SketchingMode         <-- solution folder, other projects here as well
    SketchingMode     <-- app project folder
        libs
            SystemHooks

The nice thing about this is that I can more easily update the libraries, and just use the -rXYZ specifier for the externals definition to avoid pulling in newer versions than I'm ready to accept, and still have only one copy of each file/version in my repository.

The bad thing, in this particular case, is that one of the dll's in the SystemHooks directory (2 if I want the pdb as well) needs to be copied to the output directory, not referenced by the project.

References work as normal, but once I tag one of the files in this directory as "Content" and "Copy always" or "Copy if newer", then the libs and SystemHooks directory structure is also copied to the output directory.

As such, after a build, my on-disk directory structure looks like this:

SketchingMode         <-- solution folder, other projects here as well
    SketchingMode     <-- app project folder
        libs
            SystemHooks
        bin
            Debug               <-- main build output here
                libs
                    SystemHooks <-- 1-2 files in here

Is the only way to avoid this to use the post-build steps and just add the necessary copy statements? Or can I somehow tweak the project file to avoid copying the full structure like that?

Just to make it clear, in the bin\Debug directory, I don't want another layer of libs\SystemHooks in there, and all the files presently being copied to the bin\Debug\libs\SystemHooks folder needs to be copied to the bin\Debug folder instead.

+2  A: 

How about checking out the libs directory to the level of the solution rather than the project? That is what we do since library assemblies tend to be used by multiple projects; placing direct inside one project's directory would not make for a highly shareable resource.

SketchingMode solution
  SketchingMode proj
    bin
      Debug
      Release
  Libs
    SystemHooks
icelava