473,507 Members | 9,962 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determining location of assembly programmatically

Hi,

I am coding in VB using VS 2003
If I have an assembly how can I determine if it should go into the
"C:\WINNT\assembly\GAC\" or the "C:\WINNT\assembly\GAC_MSIL\" or the
"C:\WINNT\assembly\GAC_32\" folder ...

thanks

Aug 15 '07 #1
4 3239
>I am coding in VB using VS 2003
>If I have an assembly how can I determine if it should go into the
"C:\WINNT\assembly\GAC\" or the "C:\WINNT\assembly\GAC_MSIL\" or the
"C:\WINNT\assembly\GAC_32\" folder ...
All assemblies targeting .NET 1.1 should go into the GAC directory.

Why do you have to know that? If you use the appropriate APIs or tools
to add the assembly to the GAC it's not something you have to care
about.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Aug 15 '07 #2
but when using .NET 2.0 then they are separated .. also .. i'm not
using any tools so i need to find out .. any hints would be greatly
appreciated .

thanks
On Aug 15, 1:36 pm, Mattias Sjögren <mattias.dont.want.s...@mvps.org>
wrote:
I am coding in VB using VS 2003
If I have an assembly how can I determine if it should go into the
"C:\WINNT\assembly\GAC\" or the "C:\WINNT\assembly\GAC_MSIL\" or the
"C:\WINNT\assembly\GAC_32\" folder ...

All assemblies targeting .NET 1.1 should go into the GAC directory.

Why do you have to know that? If you use the appropriate APIs or tools
to add the assembly to the GAC it's not something you have to care
about.

Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
Please reply only to the newsgroup.

Aug 15 '07 #3
>but when using .NET 2.0 then they are separated ..
Right, but you said you were using VS 2003 which only targets .NET
1.1.

>i'm not using any tools so i need to find out ..
Why not?

>any hints would be greatly appreciated .
If an assembly is built for .NET 1.x (check
Assembly.ImageRuntimeVersion) then it should go into the GAC
directory.

If it targets .NET 2.0 or later, you can check the target platform
with Module.GetPEKind. The following table should tell you which
directory it ends up in in the GAC

PortableExecutableKinds Directory
----------------------- ---------
ILOnly GAC_MSIL
Required32Bit GAC_32
PE32Plus GAC_64

But note that the internal directory layout of the GAC is an
implementation detail that could change in the future. So I wouldn't
rely on this in my code.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Aug 15 '07 #4
ka*******@hotmail.com wrote:
I am coding in VB using VS 2003
If I have an assembly how can I determine if it should go into the
"C:\WINNT\assembly\GAC\" or the "C:\WINNT\assembly\GAC_MSIL\" or the
"C:\WINNT\assembly\GAC_32\" folder ...
In all honesty, you shouldn't need to know.

GacUtil.exe, whose job it is to /put/ assemblies into the GAC, will work
this out for itself, as will the CLR when it goes looking for your
assembly to load it.

HTH,
Phill W.
Aug 16 '07 #5

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

Similar topics

2
4336
by: Vincenzo Davi | last post by:
I have created a dll with several classes in C#. One of the classes references image files in the subdirectories of the bin/Release folder (basically where the dll resides). Now, I want to use...
12
2437
by: johny smith | last post by:
I am trying to figure out a way to print the address of what called a certain function once inside the function. I am assuming that this information is on the stack somewhere. But can someone...
14
37127
by: Frances Del Rio | last post by:
I'm trying to open a url in a new window while pg loads (but NOT in a pop-up..) I need to do sthg like // while pg is loading.. window.location ='page.html' // but I need this to open in a...
18
3752
by: Praveen Ramesh | last post by:
Hi, Is there any way to add the @Assembly reference to the aspx files programmatically from inside a custom control (when it gets dropped on to the page from the toolbox)? I have a custom...
2
1847
by: Roger Helliwell | last post by:
Hey gang, What's the best way to implement a Build version (or "last updated" date) in my web-app? I have a footer in my master page that displays the application's name and copyright info etc....
4
2148
by: petermichaux | last post by:
Hi, I'm hoping for a reason I'm wrong or an alternate solution... I'd like to be able to dynamically include some javascript files. This is like scriptaculous.js library but their solution is...
0
2258
by: Mike | last post by:
Hi! I am programmatically converting Excel to PDF using Adobe PDF printer installed with Adobe Acrobat 6 and above. When I initiate Print command for this printer, a window comes up which...
4
1792
by: RossettoeCioccolato | last post by:
How do I determine programmatically whether or not the VC8 C/C++ SxS assemblies currently are installed on a system? Regards, Rossetoecioccolato.
6
1930
by: Joseph Geretz | last post by:
I'd like to break up my aplication into a WinForm executable, plus a class library containing application utility functions. But I don't want any client other than my own application to have access...
0
7221
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,...
1
7029
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...
0
7481
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4702
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...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1537
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 ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
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...

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.