473,396 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Use an object in the GAC

I installed an assembly into the GAC, now I need to use it into a dll, but
I cannot simple reference it, since I'm developing in a local machine and
maybe that on the hosting provider the GAC isn't in the same local directory
and this teorically will broke the code. At least I think so, but I'm bot
sure since I cannot take a try.

Any Idea.

I thought to use the Assembly.Load using the reflection. Is this a suitable
way?

Thanks
Andrea

Apr 6 '06 #1
9 1617
Andrea <googlegroups@fuck_the_spam_cleanmail.it> wrote in
news:9f*************************@news.microsoft.co m:
I installed an assembly into the GAC, now I need to use it into a dll,
but I cannot simple reference it, since I'm developing in a local
machine and maybe that on the hosting provider the GAC isn't in the
same local directory and this teorically will broke the code. At least
I think so, but I'm bot sure since I cannot take a try.
Don't put it in the GAC. I doubt any hosting provider will let you
register an assembly in the local GAC at all anyway.
I thought to use the Assembly.Load using the reflection. Is this a
suitable way?


Well yes, but what's wrong with just referencing it normally? Is there any
reason why it must be in the GAC?
--
Klaus H. Probst, MVP
http://www.simulplex.net/
Apr 6 '06 #2
Hello Klaus,
Well yes, but what's wrong with just referencing it normally? Is there
any reason why it must be in the GAC?


It's an object the hoster provide me for free and he has instlled in the GAC
to allow anyone to use. So it's not my own choice :(

Well ... suppose I've the object installed on my local machine, a demo, into
c:\windows\assembly ... .net knows that this is the GAC, now on the server
the GAC repository is in the d:\GAC ....

if I create a reference at my local repository, I suppose, the reference link
also the path, so my c:\windows\assembly, but when I'll deploy the code certainly
it
doesn't work, isn't it true?

Apr 6 '06 #3
Andrea <googlegroups@fuck_the_spam_cleanmail.it> wrote in
news:9f*************************@news.microsoft.co m:
Well yes, but what's wrong with just referencing it normally? Is
there any reason why it must be in the GAC?

It's an object the hoster provide me for free and he has instlled in
the GAC to allow anyone to use. So it's not my own choice :(


Oh, I see.
Well ... suppose I've the object installed on my local machine, a
demo, into c:\windows\assembly ... .net knows that this is the GAC,
now on the server the GAC repository is in the d:\GAC ....
Hopefully you didn't actually just copy the assembly to the directory? Use
gacutil.exe to install/uninstall assemblies in the GAC.
if I create a reference at my local repository, I suppose, the
reference link also the path, so my c:\windows\assembly, but when I'll
deploy the code certainly it
doesn't work, isn't it true?


Well, it will. Possibly =) The point of the GAC is that it doesn't matter
where in the machine it is physically located. So the fact that on the
server the GAC is actually on the D: drive should not matter. If you take
exactly the same assembly and install it on two different GACs on two
different machines the CLR should be resolve the types correctly when the
app domain needs it.
--
Klaus H. Probst, MVP
http://www.simulplex.net/
Apr 6 '06 #4
Hello Klaus,
Hopefully you didn't actually just copy the assembly to the directory?
Use gacutil.exe to install/uninstall assemblies in the GAC.


Did it before post.
if I create a reference at my local repository, I suppose, the
reference link also the path, so my c:\windows\assembly, but when
I'll
deploy the code certainly it
doesn't work, isn't it true?

Well, it will. Possibly =) The point of the GAC is that it doesn't
matter where in the machine it is physically located. So the fact that
on the server the GAC is actually on the D: drive should not matter.
If you take exactly the same assembly and install it on two different
GACs on two different machines the CLR should be resolve the types
correctly when the app domain needs it.


So I was worrying for nothing. Just reference and stop :)
Sometimes the life is more easier ....

Thanks

Andrea

Apr 6 '06 #5
For compile-time referencing you need another copy of the assembly
elsewhere outside GAC. Once you have it compiled, the program will
then use the one in GAC at run-time if you have no local copy. That's
why even MS assemblies which are in GAC have another copy in their
own folder in WinNT/Microsoft.NET.
"Andrea" <googlegroups@fuck_the_spam_cleanmail.it> wrote in message
news:9f*************************@news.microsoft.co m...
I installed an assembly into the GAC, now I need to use it into a dll, but
I cannot simple reference it, since I'm developing in a local machine and
maybe that on the hosting provider the GAC isn't in the same local directory
and this teorically will broke the code. At least I think so, but I'm bot
sure since I cannot take a try.

Any Idea.

I thought to use the Assembly.Load using the reflection. Is this a suitable
way?

Thanks
Andrea

Apr 6 '06 #6
Hello Klaus,

But there is one thing that I don't understand. Go to add reference, choose
browse, select c:\windows\assembly, I
select my GAC component, but it doesn't allow me to select.
It asks for the file name. I supply it, VS says it doesn't exist. Should
I select file from the gac, or from local path and
then if it will be in the GAC it will used without problems?

Andrea

Apr 6 '06 #7
Andrea <googlegroups@fuck_the_spam_cleanmail.it> wrote in
news:9f*************************@news.microsoft.co m:
But there is one thing that I don't understand. Go to add reference,
choose browse, select c:\windows\assembly, I
select my GAC component, but it doesn't allow me to select.


Never select assemblies from under the GAC =)

The problem is the way VS.NET enumerates assemblies. It doesn't do it off
the GAC. Take a look at this:

http://support.microsoft.com/default...b;en-us;306149

--
Klaus H. Probst, MVP
http://www.simulplex.net/
Apr 6 '06 #8
Hello Klaus,
Andrea <googlegroups@fuck_the_spam_cleanmail.it> wrote in
news:9f*************************@news.microsoft.co m:
But there is one thing that I don't understand. Go to add reference,
choose browse, select c:\windows\assembly, I
select my GAC component, but it doesn't allow me to select.

Never select assemblies from under the GAC =)

The problem is the way VS.NET enumerates assemblies. It doesn't do it
off the GAC. Take a look at this:

http://support.microsoft.com/default...b;en-us;306149


Well I go to the folder specified, and the hive of the component installed
by the GACutil is
there ... so according to the article is right that I can see the component .

So selecting it, since it's correctly registered in the GAC, means that VS
when compile doesn't
copy it into the bin folder and well I'll deploy my code I don't have problems.

Is it right?

Andrea

Apr 6 '06 #9
Raymond,

Just to clarify (I believe I'm right about this) at run-time the gac will be
checked for the assembly based on version first no matter what. Even if the
assembly exists in the bin folder also the one in GAC is the one that will
be used.

Regards,

Justin

"Raymond" <un*******@nothee.net> wrote in message
news:ts3Zf.50606$Fc.23819@trnddc08...
For compile-time referencing you need another copy of the assembly
elsewhere outside GAC. Once you have it compiled, the program will
then use the one in GAC at run-time if you have no local copy. That's
why even MS assemblies which are in GAC have another copy in their
own folder in WinNT/Microsoft.NET.
"Andrea" <googlegroups@fuck_the_spam_cleanmail.it> wrote in message
news:9f*************************@news.microsoft.co m...
I installed an assembly into the GAC, now I need to use it into a dll,
but
I cannot simple reference it, since I'm developing in a local machine and
maybe that on the hosting provider the GAC isn't in the same local
directory
and this teorically will broke the code. At least I think so, but I'm bot
sure since I cannot take a try.

Any Idea.

I thought to use the Assembly.Load using the reflection. Is this a
suitable
way?

Thanks
Andrea


Jun 5 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object.cs in rotor. What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What I don't...
0
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object class (Object.cs in rotor). What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What...
2
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object.cs in rotor. What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What I don't...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.