473,785 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using GAC

Hello!

I have read some info on the WWW about GAC
It says the following.

"If you want to use an assembly from the GAC,
you should drop your assemblies into a local folder,
and then add a reference to the assembly from this folder.
You may want to set the "Copy Local" property to False for
that assembly if you do not want the assembly to be copied
locally to your project folders. At runtime, the application
will automatically use the assembly from the GAC. "

This GAC as I have understood is just a folder view and does not contain
any shared library dll.

At the end of the text it says "At runtime, the application
will automatically use the assembly from the GAC. " but hello the GAC
doesn't
contain any assembly so how can it then use the assembly from the GAC
when GAS just a folder view. This must be wrong.

At runtime it must use the actual shared assembly dll otherwise it shouldn't
work.

//Tony


Aug 24 '06 #1
4 1948
Tony,

When you look at the GAC in explorer, it actually isn't a folder view.
I ^looks^ like a folder view, because there a shell handler which gives it a
folder-appearance.

The reason why you set your reference to a local copy of the assembly is
so that you can compile your code. The compiler needs to see the assembly,
and it can't pull the one from the GAC.

However, when you set the "Copy Local" property to false, what ends up
happening is that it doesn't place a copy of the referenced assembly in the
bin directory with your compiled app.

When the app runs, Fusion (the name for the mechanism in the CLR by
which assemblies are located) sees that the referenced assembly is not in
the local application directory (since it wasn't copied at build-time), and
then at some point (there are a few other locations it looks) goes to the
GAC (assuming it is strong-named).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Tony Johansson" <jo************ *****@telia.com wrote in message
news:T1******** **********@news b.telia.net...
Hello!

I have read some info on the WWW about GAC
It says the following.

"If you want to use an assembly from the GAC,
you should drop your assemblies into a local folder,
and then add a reference to the assembly from this folder.
You may want to set the "Copy Local" property to False for
that assembly if you do not want the assembly to be copied
locally to your project folders. At runtime, the application
will automatically use the assembly from the GAC. "

This GAC as I have understood is just a folder view and does not contain
any shared library dll.

At the end of the text it says "At runtime, the application
will automatically use the assembly from the GAC. " but hello the GAC
doesn't
contain any assembly so how can it then use the assembly from the GAC
when GAS just a folder view. This must be wrong.

At runtime it must use the actual shared assembly dll otherwise it
shouldn't work.

//Tony



Aug 24 '06 #2
Hello!!

Here you write
>When the app runs, Fusion (the name for the mechanism in the CLR by
which assemblies are located) sees that the referenced assembly is not
in
the local application directory (since it wasn't copied at build-time),
and
then at some point (there are a few other locations it looks) goes to
the
GAC (assuming it is strong-named).
but when the app runs it must have access to actual shared assembly dll
where
the actual code exist.

As you mention GAC is used at runtime but tell me how can it access the
actual code
when there is not actual code in GAC.

I mean when you are in runtime you must have access to the actual shared
assembly code or
I'm wrong ?

//Tony
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omskrev i
meddelandet news:ud******** ******@TK2MSFTN GP04.phx.gbl...
Tony,

When you look at the GAC in explorer, it actually isn't a folder
view.
I ^looks^ like a folder view, because there a shell handler which gives
it a
folder-appearance.

The reason why you set your reference to a local copy of the assembly
is
so that you can compile your code. The compiler needs to see the
assembly,
and it can't pull the one from the GAC.

However, when you set the "Copy Local" property to false, what ends
up
happening is that it doesn't place a copy of the referenced assembly in
the
bin directory with your compiled app.

When the app runs, Fusion (the name for the mechanism in the CLR by
which assemblies are located) sees that the referenced assembly is not
in
the local application directory (since it wasn't copied at build-time),
and
then at some point (there are a few other locations it looks) goes to
the
GAC (assuming it is strong-named).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Tony Johansson" <jo************ *****@telia.com wrote in message
news:T1******** **********@news b.telia.net...
>Hello!

I have read some info on the WWW about GAC
It says the following.

"If you want to use an assembly from the GAC,
you should drop your assemblies into a local folder,
and then add a reference to the assembly from this folder.
You may want to set the "Copy Local" property to False for
that assembly if you do not want the assembly to be copied
locally to your project folders. At runtime, the application
will automatically use the assembly from the GAC. "

This GAC as I have understood is just a folder view and does not
contain
>any shared library dll.

At the end of the text it says "At runtime, the application
will automatically use the assembly from the GAC. " but hello the GAC
doesn't
contain any assembly so how can it then use the assembly from the GAC
when GAS just a folder view. This must be wrong.

At runtime it must use the actual shared assembly dll otherwise it
shouldn't work.

//Tony






Aug 24 '06 #3
Tony,

The location where the framework keeps assemblies in the GAC is a
private implementation detail. There is actually code there, but how it is
stored there is not of concern. Just because you can't see it in explorer
doesn't mean that you can't access it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Tony Johansson" <jo************ *****@telia.com wrote in message
news:sF******** **********@news b.telia.net...
Hello!!

Here you write
>When the app runs, Fusion (the name for the mechanism in the CLR by
which assemblies are located) sees that the referenced assembly is not
in
the local application directory (since it wasn't copied at build-time),
and
then at some point (there are a few other locations it looks) goes to
the
GAC (assuming it is strong-named).

but when the app runs it must have access to actual shared assembly dll
where
the actual code exist.

As you mention GAC is used at runtime but tell me how can it access the
actual code
when there is not actual code in GAC.

I mean when you are in runtime you must have access to the actual shared
assembly code or
I'm wrong ?

//Tony
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omskrev
i meddelandet news:ud******** ******@TK2MSFTN GP04.phx.gbl...
Tony,
>
When you look at the GAC in explorer, it actually isn't a folder
view.
I ^looks^ like a folder view, because there a shell handler which gives
it a
folder-appearance.
>
The reason why you set your reference to a local copy of the
assembly is
so that you can compile your code. The compiler needs to see the
assembly,
and it can't pull the one from the GAC.
>
However, when you set the "Copy Local" property to false, what ends
up
happening is that it doesn't place a copy of the referenced assembly in
the
bin directory with your compiled app.
>
When the app runs, Fusion (the name for the mechanism in the CLR by
which assemblies are located) sees that the referenced assembly is not
in
the local application directory (since it wasn't copied at build-time),
and
then at some point (there are a few other locations it looks) goes to
the
GAC (assuming it is strong-named).
>
Hope this helps.
>
>
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
>
"Tony Johansson" <jo************ *****@telia.com wrote in message
news:T1******** **********@news b.telia.net...
>Hello!
>>
>I have read some info on the WWW about GAC
>It says the following.
>>
>"If you want to use an assembly from the GAC,
>you should drop your assemblies into a local folder,
>and then add a reference to the assembly from this folder.
>You may want to set the "Copy Local" property to False for
>that assembly if you do not want the assembly to be copied
>locally to your project folders. At runtime, the application
>will automatically use the assembly from the GAC. "
>>
>This GAC as I have understood is just a folder view and does not
contain
>any shared library dll.
>>
>At the end of the text it says "At runtime, the application
>will automatically use the assembly from the GAC. " but hello the GAC
>doesn't
>contain any assembly so how can it then use the assembly from the GAC
>when GAS just a folder view. This must be wrong.
>>
>At runtime it must use the actual shared assembly dll otherwise it
>shouldn't work.
>>
>//Tony
>>
>>
>>
>>
>>
>>
>>
>
>



Aug 24 '06 #4

Nicholas Paldino [.NET/C# MVP] wrote:
Tony,

The location where the framework keeps assemblies in the GAC is a
private implementation detail. There is actually code there, but how it is
stored there is not of concern. Just because you can't see it in explorer
doesn't mean that you can't access it.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
Which leads me to point out that the missing piece in this whole
discussion is that at some point you have to install your shared
assembly into the GAC. You can't just compile your application using
the assembly in a project bin directory, without making a local copy of
the shared assembly, and then run the application and it magically
finds the shared assembly in the GAC.

You have to build the shared assembly (DLL), install it in the GAC
(which copies the intermediate code into the GAC and registers it),
then compile the application pointing to the shared assembly in its
original directory (without copying it into the application's bin
directory), then run the application, which will find the copy of the
shared assembly that you installed in the GAC.

If you don't do the install-into-GAC step, the application will fail
because it can't find one of the assemblies upon which it depends. Or,
if the version of the shared assembly in the GAC is not the same
version with which the application was compiled, it will also fail
because it can't find the correct version. (Note that this is not
strictly true... there are ways around this problem, but this is the
default behaviour.)

Aug 24 '06 #5

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

Similar topics

5
5717
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ================================================================= Error 19: "CORBAManagerMessages.h", line 4 # Unexpected 'std'. using std::string; ^^^
3
2166
by: Mike L | last post by:
Should the command call "using" be before or after my namespace? **AFTER** namespace DataGridBrowser { using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Collections;
3
2444
by: xzzy | last post by:
I was wondering why we have to have using System.Data using System.Configuration using etc.... why are they not all lumped into one 'using'? In other words, is there a best way to use project classes with 'using' meaning
14
5803
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the SQL DATABASE, probably by the click of a button. Is this possible? & what is the BEST APPROACH for doing this? & also if any links are there do tell those to me too coz I have no idea how to go about doing it.
8
2415
by: acb | last post by:
Hi, I wrote a DLL Component (using Visual Studio 2005) and managed to include it into a C# Console application. I am now trying to include this component into a Web project. I copy the DLL into the bin directory but am not able to progress. Can anyone please guide me to an online tutorial on the subject. Thanks,
0
2208
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase .NET 2.0 DataProvider (iAnywhere.Data.AsaClient.dll) into the GAC so it can be used in the ProviderName property of a SQLDataSource and loads properly at run time. The application I'm writing is a bit more complex than the example I'm about to...
10
1971
by: mg | last post by:
I'm migrating from VB6 and have a question about using 'Using' and the best way to use it. Here is a example of a small bit of code: dbConx("open") Using CN Dim CMD As New OleDbCommand(sSQL, CN) Dim DR As OleDbDataReader = CMD.ExecuteReader()
0
2573
by: Eugene Anthony | last post by:
The problem with my coding is that despite removing the records stored in the array list, the rptPages repeater control is still visible. The rptPages repeater control displayes the navigation link (1,2,3 so on). The code can be found in SubscriptionCart.aspx.cs. Default.aspx ------------
3
8299
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0 build with these methods, will appear to encrypt and decrypt, but the resulting decrypted file will be corrupted. I tried encrypting a .bmp file and then decrypting, the resulting decrypted file under .NET 2.0 is garbage, the .NET 1.1 build works...
6
5168
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick application working. However, when attempting to implement the solution, the AJAX calls weren't updating the screen like the examples were and seemed not to fire until after the long running process had completed. I found the only real...
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10324
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.