views:

56

answers:

1

I have a WinForms application with a bunch of third party references. This makes the output folder quite messy. I'd like to place the compiled / referenced dlls into a common subdirectory in the output folder, bin / lib - whatever - and just have the executables (+ needed configs etc) reside in the output folder.

After some searching I ran into assembly probing (http://msdn.microsoft.com/en-us/library/4191fzwb.aspx) - and verified that if I set this up and manually move the assemblies my application will still work if they are stored in the designated subdirectory like so:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin" />
    </assemblyBinding>
  </runtime>
</configuration>

However, this doesn't solve the build part - is there any way to specify where referenced assemblies and compiled library assemblies go?

Only solutions I can think of off the top of my head is either post-build actions or dropping the idea and using ILMerge or something.

There has got to be a better way of defining the structure :-)

A: 

If you're building within Visual Studio, you can definitely set up post build actions - they work quite nicely. I don't really think there's any other good, documented way to do this. Unfortunately, when you reference another assembly, there's no option to define where to copy that referenced DLL to in the build process, I believe.

Of course, if you're building those assemblies from source code, you could just set up their output directory to be (app)\bin or (app)\lib from the beginning, and the build process would spit them into the right directory right from the get go.

If you're using a more sophisticated build server, you probably have means of moving a handful of DLL files to a separate directory in that tool, too.

marc_s