Have you ever wanted a more elegant deployment solution than dumping all the files into a single folder?

One of the great advantages of the .NET platform is its incredible depth. This is also an incredible problem, as there is so much to know - and it’s very easy to miss things that have been there for several releases. Here’s one example - probing paths.

For a project at work, I build a commandline client, designed to exercise the core services without much overhead.

I wasn’t happy with the deployment folder, as it wasn’t that clear which file should be executed.

Fortunately, I was able to move all the supporting assemblies into a bin subfolder just by adding a bit of configuration to my .config file:

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

This configures the main AppDomain to also look for any required assemblies in a \bin\ folder underneath the main folder for the application, giving me this result:

For a simple application like this, the difference is more esthetic than anything else … but for a more complex application with many supporting assemblies, this can help you tidy up your deployment structure so it’s a bit less untidy.


blog comments powered by Disqus