Search code examples
.netvisual-studio-2010unity2.0

Unity 2.0 loose dependencies - dll copying


I have a simple question that I think someone will answer very fast, but I tried to find the answer myself and couldn't (maybe just bad luck).

The thing is, that I have a .NET 4 solution in VS2010 Ultimate in which I want to take advantage of Unity 2.0. I have some modules designed to be seperate, where I connect the code by a shared *.Contracts assembly (e.g. classes in DAL implement interfaces from DAL.Contracts, and Services require types implementing interfaces from DAL.Contracts).

The problem is, that I have to get the compiled files into the final output directory. Adding reference seems strange, after all I didn't want a reference (and I know that it can be done without it). Adding the files as links with "Copy when newer" option is not good too (no way to differentiate between Debug and Release builds). What is the consensus about the best way to make the compiled components copy to the directory with the topmost assembly?


Solution

  • Use PostBuild events as @DaMartyr suggests or decompose that part of your build out of the solution and use batch files or something like NAnt or MSBuild to move files to where they need to go for debugging.

    I find for anything non-trivial taking the extra steps to create a build script outside of visual studio to be the way to go as it can be used by the build process and is easier to manage than build events.