how to configure dot-net to locate a dll

Z

z. f.

Hi,

i have a dll that is used by many dot-net console application that is located in different folders and these applications all using the same dll.
when i make reference the dot-net make a copy of the dll near the exe.
but i want only one copy of the dll to be on the computer.
how do i configure the dot-net to use the dll from the same location all the time?

TIA, z.
 
R

Richard Blewett [DevelopMentor]

You'll have to strong name the assembly and deploy it either in the GAC or via a codebase hint

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<[email protected]>

Hi, i have a dll that is used by many dot-net console application that is located in different folders and these applications all using the same dll. when i make reference the dot-net make a copy of the dll near the exe. but i want only one copy of the dll to be on the computer. how do i configure the dot-net to use the dll from the same location all the time? TIA, z. This post contained attachments. By default, NewsGator will not download attachments, but can be configured to do so. If you wish to automatically download attachments for this newsgroup, go to NewsGator/Subscriptions, select this group and click Edit, and change the Options.


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.782 / Virus Database: 528 - Release Date: 22/10/2004



[microsoft.public.dotnet.framework]
 
Z

z. f.

can you just explain in a sentense about each of the options - how it is done.

and BTW becarefull from exposing your email in a clean way in the news group, you'll get junk mail soon.


TIA!!!

You'll have to strong name the assembly and deploy it either in the GAC or via a codebase hint

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<[email protected]>

Hi, i have a dll that is used by many dot-net console application that is located in different folders and these applications all using the same dll. when i make reference the dot-net make a copy of the dll near the exe. but i want only one copy of the dll to be on the computer. how do i configure the dot-net to use the dll from the same location all the time? TIA, z. This post contained attachments. By default, NewsGator will not download attachments, but can be configured to do so. If you wish to automatically download attachments for this newsgroup, go to NewsGator/Subscriptions, select this group and click Edit, and change the Options.


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.782 / Virus Database: 528 - Release Date: 22/10/2004



[microsoft.public.dotnet.framework]
 
R

Richard Blewett [DevelopMentor]

Thanks for the tip - I'd forgotten I put it in clear text as I post via Newsgator. Mind you, I can't imagine any way I could get more spam than I currently do ;-)

Strong Naming:
You need to sign the assembly with a public/private key pair generated via the strong name utility (sn.exe). You execute
sn -k <keyfile name>
to generate the key pair and then sign the assembly using AssemblyKeyFile attribute (if you build with VS.NET you will find it in the AssemblyInfo.cs file). This operation changes the name of the assembly so you will have to recompile all of the components that use this assembly.

GAC
the Global Assembly Cache (GAC) is the .NET equivelent of the SYSTEM32 directory iun that if you put your component inn there all code looking for it will be able to find it. However, unlike SYSTEM32 it is not prone to different versions of a DLL overwriting eachother, multiple versions can live in there side by side. You install a component in the GAC via gacutil.exe
gacutil -i <assembly file name>

Codebase hint
A code base hint is a mapping from a strong named assembly version to a physical location for that assembly. It is put in the config file for an application (although you could also put it in the machine.config IIRC). Look at the help for the <codebase> element of an application config file. BTW: its called a hint because the assembly resolver will look in the GAC before checking for codebase hints.

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<#[email protected]>

can you just explain in a sentense about each of the options - how it is done. and BTW becarefull from exposing your email in a clean way in the news group, you'll get junk mail soon. TIA!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top