views:

250

answers:

1

hi,

I've a native binary dependency for my c# solution which comes in Debug and Release variants, and I'm trying to figure out how to best organize this such that (1) It ends up in the build output, and is found when running unit tests (2) It lives under the checkout directory in source control (3) The correct variant (debug/release) is copied for each build configuration

I'm looking at

Solution  
    Libs  
        MyLibrary  
            Debug/x86/foo.dll  
            Release/x86/foo.dll   
    MyProject  
        src/com/acme/MyApplication.cs

MyProject references MyLibrary

and I'd like the build folders to look like:

Solution/MyProject/bin/Debug/  
    x86/foo.dll <-- copied from MyLibrary/Debug  
    MyApplication.exe  
Solution/MyProject/bin/Release/
    x86/foo.dll <-- copied from MyLibrary/Release  
    MyApplication.exe

I'm trying to do this without a custom msbuild file - everything would ideally build from the solution and project files.

Anyone have ideas how to do this? (or suggestions how to reorganize the sources to achieve something similar?)

I have a few libraries like this, so splitting them all into two (Library_Debug, Library_Release) isn't really an option.

any help appreciated ;)

+2  A: 

You can add pre- and post- build steps to your solution. I can't remember off the top of my head the mechanics of determining if you're doing a debug or release build, but you should be able to set up the dependencies so they point to a temp directory, and copy in the appropriate set of dlls.

chris