Changing location of the /bin directory

  • Thread starter Thread starter Dylan Parry
  • Start date Start date
D

Dylan Parry

Hi,

Please forgive me if this isn’t the correct newsgroup – if it’s not,
which one would be a better choice? Anyhow, to my question…

By default, the “/bin†directory where you’d keep all the DLL files for
a web application is set to live within the root directory of the site.
What I’d like to do is move it to somewhere else and still have my site
use it. Eg.

My site lives at “C:\iis\sites\mysite\†and the “/bin†directory is at
“C:\iis\sites\mysite\bin\â€. I’d like to create a directory at
“C:\mybin\†(or anywhere else for that matter) and have my site use that
directory as its “/bin†directory.

The reason I want to do this is so that more than one site can share the
same “/bin†directory without me having to mess around with the GAC,
which annoyingly requires an IIS restart every time the DLL files are
updated. I have several client sites that all use the same DLL files, so
having them stored in a central location makes it much easier to
maintain rather than having to upload the same DLLs to a dozen or more
sites each time I fix a bug or add a new feature!

I’m currently using the GAC for this, but it’s messy and I thought it
would be much more sensible to have some sort of shared “/bin†directory
that would only store DLL files relevant to the application.

Okay, now I’m babbling. Short story: is this possible?

Cheers,
 
Patrice said:
Hello,

Try perhaps :
http://msdn.microsoft.com/en-us/library/823z9h8w.aspx (but it looks like it
should be a subdir).

Indeed. Doesn’t look like that would work :(
You could also try at the OS level for example you could try how it behaves
when you use a hardlink :
http://technet.microsoft.com/en-us/library/cc788097(WS.10).aspx

That’s a possibility, but it would require having to set up hardlinks
for each DLL file within the “/binâ€. I guess I could do that with a
“.bat†file when I set up the sites, but could be a lot of work if I had
to add a completely new DLL to a site. Can’t see any way of setting up
hardlinks for a directory rather than a single file – is that possible?
If so, that would be a much easier solution…
For now my personal preference has always been to use a batch file (possibly
based on robocopy) to keep several sites in sync (and I still keep the
ability to handle them individually when needed).

Yes, I used to do that too before resorting to the GAC. Problem there
was that it got to the point that there were so many sites that it made
maintaining the “.bat†a PITA; I’d inevitably forget to add a new client
to the script at some point, and the world would tumble down around me :(
 
Hi Dylan,

Normally you should be able to move the /bin directory anywhere in your
application, but you can't do this at the root of you hard drive (i.e:
C:\). This is due to permissions rights and security.

A good way is to keep this directory at its original place because it's
project dependent.

If you want to share components between several projects you'd better
link the assemblies into the reference folder in Visual Studio.

P.S : Sorry for my English I'm a French.

Samir
 
Dylan said:
Can’t see any way of setting up hardlinks for a directory rather than
a single file – is that possible? If so, that would be a much easier
solution…

I found a small command line application called “linkdâ€, which is part
of a set of tools from Microsoft. Seems it allows me to set up something
called “junctionsâ€, whatever they are! Either way, they look like
shortcuts in Explorer, but you can also see them in the command line, so
they appear to work in the same way that hardlinks do!

I’ve given it a try and managed to set up a junction called “bin†in my
site’s root directory, where the actual directory contents are in
another directory below the root! So it works wonderfully :)

Thanks for pointing me in the right direction.
 
Back
Top