How multiple web sites can share one binary folder

I answered a post about how you can share a single binary folder with many web sites. I can certainly see the advantage of having configurable sites (different web configs) but share the same binary folder to make it easier for maintenance. My first thought was that you could use virtual folders but unfortunately the code probing won’t see the virtual folder…shame. So I looked into the ye olde unix (or nix) style of symbolic links, thing create shortcut link on steriods.  My first idea was to create a ‘hardlink’ of the bin folder itself. E.g.

ActualBinaries\Bin

Web1\Bin (really hardlink to ActualBinaries\Bin)

Web2\Bin (really hardlink to ActualBinaries\Bin)

Although the CLR did indeed go to the correct folder it failed to load the assemblies in there complaining that the format of the path was wrong. So sensing that I was close to something I tried creating an real bin folder and hardlink the indicidual files. E.g.

ActualBinaries\bin\MyComponent.dll

Web1\bin\MyComponent.dll (really hardlink to ActualBinaries\bin\MyComponent.dll)

Web2\bin\MyComponent.dll (really hardlink to ActualBinaries\bin\MyComponent.dll)

Now that worked! So how do create one of these links? Well it’s actually quite straightforward;
fsutil hardlink create
"C:\Web2\bin\MyComponent.dll"
"C:\ActualBinaries\bin\MyComponent.dll"

Apparently Powershell can easily create them too, although I’ve yet to try that. So is it worth the effort? I can see that running one MSI would be handy, especially when you’ve got COM registrations going on. However if you’ve only got .net components and no extra registrations then I doubt it’s worth the extra effort.

One thought on “How multiple web sites can share one binary folder

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s