By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,892 Members | 1,156 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,892 IT Pros & Developers. It's quick & easy.

Global Assembly Cache

P: n/a
I took over a legacy e-commerce project that utilized.NET 1.1 to create the
website code and all associated assemblies. This code is used to power
around 75 web sites on a single web server. Right now they have a separate
directory for each store, complete with a \bin folder that contains about 20
DLL files. The \bin folder is replicated for each store, so we have about 70
copies (I'll explain the missing 5 in a second) of the same \bin directory
sitting around. When it comes time to make a change in the code, it's a
pain.

Here are my questions:

1) Can I simply drop these DLL files in the GAC (I'm aware of the
requirements for registering an assembly in the GAC) and then delete the
corresponding DLL files in the \bin folder for each site?

2) There are 5 or 6 sites that have had customizations performed to the
code. I do NOT want these few sites to load the assembly from the GAC,
rather I want them to continue to load the DLL in it's \bin folder. Can I
override the GAC files by simply keeping the custom DLL in the sites \bin
folder? If not, what's the recommended approach?

Remember, this is all .NET 1.1. :)

Thanks!

Scott

Nov 10 '08 #1
Share this Question
Share on Google+
7 Replies


P: n/a
2) There are 5 or 6 sites that have had customizations performed to the
code. I do NOT want these few sites to load the assembly from the GAC,
rather I want them to continue to load the DLL in it's \bin folder. Can I
override the GAC files by simply keeping the custom DLL in the sites \bin
folder? If not, what's the recommended approach?
I'm 100% certain, but I believe that the application will first look
in the app folder for the assembly before looking in the GAC. In any
case, you can install both versions of the assembly in the GAC and
then in the web.config file (or machine.config) you can redirect the
app to the correct version in the GAC.

Something like this:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="assemblyName" culture=""
publicKeyToken="25283151a234958d"/>
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/
>
</dependentAssembly>
</assemblyBinding>
</runtime>

Chris
Nov 10 '08 #2

P: n/a
"Scott Stark" <em***@scottstark.comwrote in message
news:eU**************@TK2MSFTNGP05.phx.gbl...
1) Can I simply drop these DLL files in the GAC (I'm aware of the
requirements for registering an assembly in the GAC) and then delete the
corresponding DLL files in the \bin folder for each site?
Yes.
Since you mention that you are already aware of the requirements, I
will not mention that the DLLs need to have a Strong Name :)
2) There are 5 or 6 sites that have had customizations performed to the
code. I do NOT want these few sites to load the assembly from the GAC,
rather I want them to continue to load the DLL in it's \bin folder. Can I
override the GAC files by simply keeping the custom DLL in the sites \bin
folder? If not, what's the recommended approach?
Remember, this is all .NET 1.1. :)
It's not that simple -- the GAC will take priority. The easiest approach
is to assign a different version number (using the
[assembly:AssemblyVersion(...)] attribute) to the customized DLLs. Each web
site will load the same version of the DLL with which it was compiled,
regardless of wether that version sits on the GAC or the bin folder.
Nov 10 '08 #3

P: n/a
Hi Chris,

Thanks for the response.

I assume both versions of the DLL use the same strong name, they just differ
in their version numbers, correct? So 1.0.0.0 is my core DLL file and
2.0.0.0 is for Custom Store A, 3.0.0.0 is for Custom Store B, etc?

Then I'd update the web.config file as you suggested for the custom stores?
Do I need a redirect for version 1.0.0.0 on all the other stores (which one
does it use by default)? The only other question I have is how to generate
the code for web.config (publickeytoken, etc). Where does all that info come
from?

Sorry for the basic questions, haven't had much opportunity to deal with
this stuff before.

Thanks,

Scott

"Chris Dunaway" <du******@gmail.comwrote in message
news:c9**********************************@w1g2000p rk.googlegroups.com...
>2) There are 5 or 6 sites that have had customizations performed to the
code. I do NOT want these few sites to load the assembly from the GAC,
rather I want them to continue to load the DLL in it's \bin folder. Can I
override the GAC files by simply keeping the custom DLL in the sites \bin
folder? If not, what's the recommended approach?

I'm 100% certain, but I believe that the application will first look
in the app folder for the assembly before looking in the GAC. In any
case, you can install both versions of the assembly in the GAC and
then in the web.config file (or machine.config) you can redirect the
app to the correct version in the GAC.

Something like this:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="assemblyName" culture=""
publicKeyToken="25283151a234958d"/>
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/
>>
</dependentAssembly>
</assemblyBinding>
</runtime>

Chris
Nov 10 '08 #4

P: n/a
Thank you! Between you and Chris, I think I've got my answers.

"Alberto Poblacion" <ea******************************@poblacion.orgwro te
in message news:Ox****************@TK2MSFTNGP03.phx.gbl...
"Scott Stark" <em***@scottstark.comwrote in message
news:eU**************@TK2MSFTNGP05.phx.gbl...
>1) Can I simply drop these DLL files in the GAC (I'm aware of the
requirements for registering an assembly in the GAC) and then delete the
corresponding DLL files in the \bin folder for each site?

Yes.
Since you mention that you are already aware of the requirements, I
will not mention that the DLLs need to have a Strong Name :)
>2) There are 5 or 6 sites that have had customizations performed to the
code. I do NOT want these few sites to load the assembly from the GAC,
rather I want them to continue to load the DLL in it's \bin folder. Can I
override the GAC files by simply keeping the custom DLL in the sites \bin
folder? If not, what's the recommended approach?
Remember, this is all .NET 1.1. :)

It's not that simple -- the GAC will take priority. The easiest
approach is to assign a different version number (using the
[assembly:AssemblyVersion(...)] attribute) to the customized DLLs. Each
web site will load the same version of the DLL with which it was compiled,
regardless of wether that version sits on the GAC or the bin folder.

Nov 10 '08 #5

P: n/a
"Scott Stark" <em***@scottstark.comwrote in message
news:e0**************@TK2MSFTNGP03.phx.gbl...
I assume both versions of the DLL use the same strong name, they just
differ in their version numbers, correct?
You mean the same *key*. The version number is part of the Strong Name.

Then I'd update the web.config file as you suggested for the custom
stores? Do I need a redirect for version 1.0.0.0 on all the other stores
(which one does it use by default)? The only other question I have is how
to generate the code for web.config (publickeytoken, etc). Where does all
that info come from?
If you are using the Framework 1.1 you don't need to worry about
entering the assembly versions in web.config. Just Add a Reference to the
DLL you want to use, and build the project. The version number of the
Referenced DLL will be built into the main DLL that contains the code of
your website, so it will know which version to call.

Also, in your specific case, you don't want to redirect any DLLs to a
different version. This is precisely what you are trying to *avoid*, that
is, you want each site to use its own DLL (the one with which it was
compiled) instead of being redirected to a different version.
On the other hand, you could compile all sites with the same DLL, and
then add a Redirect in web.config to force a site to use a different version
at runtime.

Nov 10 '08 #6

P: n/a
Hi Alberto,

Thanks for the explanations. In this case, I'm not referencing an assembly
within the project. It's the main website assembly (the one that contains
all the code-behind files from my ASPX pages) that I want in the GAC.

"Alberto Poblacion" <ea******************************@poblacion.orgwro te
in message news:u0*************@TK2MSFTNGP03.phx.gbl...
"Scott Stark" <em***@scottstark.comwrote in message
news:e0**************@TK2MSFTNGP03.phx.gbl...
>I assume both versions of the DLL use the same strong name, they just
differ in their version numbers, correct?

You mean the same *key*. The version number is part of the Strong Name.

>Then I'd update the web.config file as you suggested for the custom
stores? Do I need a redirect for version 1.0.0.0 on all the other stores
(which one does it use by default)? The only other question I have is how
to generate the code for web.config (publickeytoken, etc). Where does all
that info come from?

If you are using the Framework 1.1 you don't need to worry about
entering the assembly versions in web.config. Just Add a Reference to the
DLL you want to use, and build the project. The version number of the
Referenced DLL will be built into the main DLL that contains the code of
your website, so it will know which version to call.

Also, in your specific case, you don't want to redirect any DLLs to a
different version. This is precisely what you are trying to *avoid*, that
is, you want each site to use its own DLL (the one with which it was
compiled) instead of being redirected to a different version.
On the other hand, you could compile all sites with the same DLL, and
then add a Redirect in web.config to force a site to use a different
version at runtime.
Nov 10 '08 #7

P: n/a
"Scott Stark" <em***@scottstark.comwrote in message
news:ug**************@TK2MSFTNGP04.phx.gbl...
Thanks for the explanations. In this case, I'm not referencing an assembly
within the project. It's the main website assembly (the one that contains
all the code-behind files from my ASPX pages) that I want in the GAC.
Ah. That's very different from what I had in mind. I'm not even sure
that this will work if you place it in the GAC. You will have to experiment
a little bit.

Nov 10 '08 #8

This discussion thread is closed

Replies have been disabled for this discussion.