473,692 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assembly GUID

Nak
Hi there,

Does anyone know how I would get the value of the assembly GUID in code
from within the same application? Thanks in advance.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #1
14 14264
Hi Nick,
you can get most Assembly info from the System.Reflecti on namespace.
You get the current domain from the AppDomain type, then get the list of
assemblies from it. When you find the assembly that you are looking for (the
list contains all the system assemblies as well), check the referenced
assemblies for that one assembly - the referenced assembly is of type
AssemblyName, and you can get a load of info from that. I'm not sure about
the GUID, but it as a PublicKeyToken property, which may be what you are
looking for....

Here's some code to get you started:

Dim ad As AppDomain

Dim ass As System.Reflecti on.Assembly

Dim add() As System.Reflecti on.Assembly = ad.CurrentDomai n.GetAssemblies ()

Dim addRef() As System.Reflecti on.AssemblyName

Dim addRefItem As System.Reflecti on.AssemblyName

For Each ass In add

If ass.ToString.Su bstring(0, 5).ToUpper = "THE APP NAME" Then

addRef = ass.GetReferenc edAssemblies

For Each addRefItem In addRef

Next

Next



"Nak" <a@a.com> wrote in message
news:Or******** ******@tk2msftn gp13.phx.gbl...
Hi there,

Does anyone know how I would get the value of the assembly GUID in code from within the same application? Thanks in advance.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Nov 20 '05 #2
Nak
Hi Thomas,

Thanks for your help, the GUID that I am after is actually the one that is
exposed to COM, if you take a look in the AssemblyInfo.vb file you will see
the lines,

'The following GUID is for the ID of the typelib if this project is exposed
to COM
<Assembly: Guid(" GUID goes in here ")>

I am after getting this GUID programatically . I thought it might be in the
application object, as is everything else that is in the Assembly file but
it isn't. I want to use it for making toolbar and menu buttons for Internet
Explorer, and for this you need to provide a GUID. I didn't want to just
use a randomly generated GUID just incase it had been used perviously
(though I am not sure of the chances of this happening are). So I thought
if I use my applications GUID this would solve all problems. I'm short of
copying an pasting but I don't like canning things like that.

Thanks for your help though, any ideas on the above?

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"Thomas" <no****@nospam. nospam> wrote in message
news:uy******** ******@tk2msftn gp13.phx.gbl...
Hi Nick,
you can get most Assembly info from the System.Reflecti on namespace.
You get the current domain from the AppDomain type, then get the list of
assemblies from it. When you find the assembly that you are looking for (the list contains all the system assemblies as well), check the referenced
assemblies for that one assembly - the referenced assembly is of type
AssemblyName, and you can get a load of info from that. I'm not sure about
the GUID, but it as a PublicKeyToken property, which may be what you are
looking for....

Here's some code to get you started:

Dim ad As AppDomain

Dim ass As System.Reflecti on.Assembly

Dim add() As System.Reflecti on.Assembly = ad.CurrentDomai n.GetAssemblies ()

Dim addRef() As System.Reflecti on.AssemblyName

Dim addRefItem As System.Reflecti on.AssemblyName

For Each ass In add

If ass.ToString.Su bstring(0, 5).ToUpper = "THE APP NAME" Then

addRef = ass.GetReferenc edAssemblies

For Each addRefItem In addRef

Next

Next



"Nak" <a@a.com> wrote in message
news:Or******** ******@tk2msftn gp13.phx.gbl...
Hi there,

Does anyone know how I would get the value of the assembly GUID in

code
from within the same application? Thanks in advance.

Nick.

--

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\


Nov 20 '05 #3
Nak
Sorry, Hi again,

I have found that using the following obtains a GUID

System.Reflecti on.Assembly.Get ExecutingAssemb ly.GetType.GUID .ToString

But the GUID returns is not identical to the one in the AssemblyInfo
file, but, this may still be what I am after. Any idea why this GUID is
different? Thanks again.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"Nak" <a@a.com> wrote in message
news:OQ******** *****@tk2msftng p13.phx.gbl...
Hi Thomas,

Thanks for your help, the GUID that I am after is actually the one that is
exposed to COM, if you take a look in the AssemblyInfo.vb file you will see the lines,

'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid(" GUID goes in here ")>

I am after getting this GUID programatically . I thought it might be in the application object, as is everything else that is in the Assembly file but
it isn't. I want to use it for making toolbar and menu buttons for Internet Explorer, and for this you need to provide a GUID. I didn't want to just
use a randomly generated GUID just incase it had been used perviously
(though I am not sure of the chances of this happening are). So I thought
if I use my applications GUID this would solve all problems. I'm short of
copying an pasting but I don't like canning things like that.

Thanks for your help though, any ideas on the above?

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ "Thomas" <no****@nospam. nospam> wrote in message
news:uy******** ******@tk2msftn gp13.phx.gbl...
Hi Nick,
you can get most Assembly info from the System.Reflecti on namespace.
You get the current domain from the AppDomain type, then get the list of
assemblies from it. When you find the assembly that you are looking for

(the
list contains all the system assemblies as well), check the referenced
assemblies for that one assembly - the referenced assembly is of type
AssemblyName, and you can get a load of info from that. I'm not sure about
the GUID, but it as a PublicKeyToken property, which may be what you are
looking for....

Here's some code to get you started:

Dim ad As AppDomain

Dim ass As System.Reflecti on.Assembly

Dim add() As System.Reflecti on.Assembly = ad.CurrentDomai n.GetAssemblies ()
Dim addRef() As System.Reflecti on.AssemblyName

Dim addRefItem As System.Reflecti on.AssemblyName

For Each ass In add

If ass.ToString.Su bstring(0, 5).ToUpper = "THE APP NAME" Then

addRef = ass.GetReferenc edAssemblies

For Each addRefItem In addRef

Next

Next



"Nak" <a@a.com> wrote in message
news:Or******** ******@tk2msftn gp13.phx.gbl...
Hi there,

Does anyone know how I would get the value of the assembly GUID in

code
from within the same application? Thanks in advance.

Nick.

--

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\



Nov 20 '05 #4
"Nak" <a@a.com> schrieb
Sorry, Hi again,

I have found that using the following obtains a GUID
System.Reflecti on.Assembly.Get ExecutingAssemb ly.GetType.GUID .ToString
But the GUID returns is not identical to the one in the
AssemblyInfo
file, but, this may still be what I am after. Any idea why this GUID
is different? Thanks again.

Imports System.Reflecti on
Imports System.Runtime. InteropServices

'...

Dim assy As [Assembly]
Dim Attributes As Object()

assy = [Assembly].GetExecutingAs sembly
Attributes = assy.GetCustomA ttributes(GetTy pe(GuidAttribut e), False)

If Attributes.Leng th = 0 Then
MsgBox("no guid attribute")
Else
MsgBox(DirectCa st(Attributes(0 ), GuidAttribute). Value)
End If

--
Armin

Nov 20 '05 #5
Nak
>Unfortunatel y, pervious use of GUIDs is becoming increasingly common.

LOL! You know what I meant haha :-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #6
Nak
Thank you very much Armin :-)

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

--
Armin

Nov 20 '05 #7
Nak
As a matter of interest, why the "[]" square braces around the declarations,
what does it do? Thanks in advance.

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Slow internet connection?
Having problems with you job?
You're marriage is on the rocks?
You can't sleep at night?
You have a drink and drugs addiction?
You are sexually impotent?
Then enable Option Strict!
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"Armin Zingler" <az*******@free net.de> wrote in message
news:Op******** *****@TK2MSFTNG P09.phx.gbl...
"Nak" <a@a.com> schrieb
Sorry, Hi again,

I have found that using the following obtains a GUID
System.Reflecti on.Assembly.Get ExecutingAssemb ly.GetType.GUID .ToString
But the GUID returns is not identical to the one in the
AssemblyInfo
file, but, this may still be what I am after. Any idea why this GUID
is different? Thanks again.

Imports System.Reflecti on
Imports System.Runtime. InteropServices

'...

Dim assy As [Assembly]
Dim Attributes As Object()

assy = [Assembly].GetExecutingAs sembly
Attributes = assy.GetCustomA ttributes(GetTy pe(GuidAttribut e), False)

If Attributes.Leng th = 0 Then
MsgBox("no guid attribute")
Else
MsgBox(DirectCa st(Attributes(0 ), GuidAttribute). Value)
End If

--
Armin

Nov 20 '05 #8
"Nak" <a@a.com> schrieb:
As a matter of interest, why the "[]" square braces around the
declarations, what does it do? Thanks in advance.


http://msdn.microsoft.com/library/en...amesincode.asp

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet

Nov 20 '05 #9
"Nak" <a@a.com> schrieb
As a matter of interest, why the "[]" square braces around the
declarations, what does it do? Thanks in advance.


Assembly is a VB keyword. To distinguish between the keyword and the data
type, the braces are used.

see also:
<F1>
Visual Studio.NET
Visual Basic and Visual C#
Reference
Visual Basic language
Visual Basic Language Tour
Features
Declared elements
Name of declared elements

Direct link (VS 2003):
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB/vbcn7/html/vbconElementNam es.htm

(see hints in signature)
--
Armin

- Links might be split into two lines. Concatenate them using notepad.
- Links might require to add a ".nnnn" after the "2003FEB", e.g.
"2003FEB.10 33" for localized versions.
- Links starting with "ms-help" are URLs for the document explorer (<F1>).
Paste them in the URL textbox and press enter. Using internal help (menu
tools -> options -> environment -> help), display the "Web" toolbar that
contains the textbox.
- The tree representing the table of contents has been translated from
localized (German) version. Excuse slight deviations.
Nov 20 '05 #10

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

Similar topics

0
1407
by: James Thurley | last post by:
I'm trying to dynamically compile assemblies and cache them to disk, which seems to work fine. When the data I'm compiling from changes, I want to re-generate the assembly and use the new version. After I re-generate the assembly, I get the type I want from it and then invoke a static method. I have found the following behaviour: 1. If I always regenerate the assembly with a completely new name,
5
4210
by: Tamir Khason | last post by:
I have compiled libraries as dlls (managed) and I have to uniquely enumerate it (kind of Guid for each one). All of them implements the same interface (see code block) and generate ID each time it called. I want to fix it into assembly (option 1) or use any internal GUID of assemble if possible (Option 2). How to implement it without changing all implementation classes (including abstracts)? Are any unique ID for compiled dll in .NET? ...
2
1252
by: Brian Henry | last post by:
Is there anyway to retrieve the GUID code of an assembly for use in the application as a unique identifier? thanks!
1
5452
by: Brian Henry | last post by:
I need to mark assemblies with a unique id (GUID in this case) and retrieve it when the assembly is loaded into my application (a plug-in loader)... the plug-in assembly all have a class in it which implements our plug-in base class (which really is a default implementation of a interface IPlugin we created) The plug-in class looks like this Imports bdb
3
2017
by: Jozef | last post by:
Hello, I apologize for such a newbie question, but I'd like to know if there's any way to reference the assembly GUID? Thanks!
3
1819
by: pranesh.nayak | last post by:
Hello group, I'm facing a problem in calling a signed .Net class library (c#) from VB6 exe. I have a VB6 exe calling .net assembly. The call to .Net dll works fine when i deploy the .Net assembly as Private assembly. But here the only issue is i need to place .Net dll and VB6 exe in same location. To avoid this location dependency issue i tried registering the .Net
2
3491
by: Rob R. Ainscough | last post by:
I tried the following and it does provide a GUID, but not the GUID listed in the My Project ... Assembly Info button. Dim myAss As myAss = .GetEntryAssembly Dim myAssGUID As System.Guid = myAss.ManifestModule.ModuleVersionId Dim myStringGUID As String = myAssGUID.ToString tried using GetCallingAssembly, GetExecutingAssembly and none of them reprsent the GUID listed under My Project | Application | Assembly
2
3477
by: PJ6 | last post by:
In VS.Net 2K3, a GUID use to be automatically included in the project's assemblyinfo.vb file: 'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid("9CD13E54-9AD0-4AF5-9005-BC45A3DCAA36")> What's the easiest way to do it now? It's not for signing or COM, I just want a unique identifier that's a little more reliable than the physical filename.
5
7854
by: Jim | last post by:
I am trying to compile a demo from the XNA site and I get this error Error 1 Assembly generation failed -- Error emitting 'System.Runtime.InteropServices.GuidAttribute' attribute --'Incorrect UUID format.' MarbletsWindows The only place I can see this assemble being used is here: // The following GUID is for the ID of the typelib if this project is exposed to COM
0
8545
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9090
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...
0
8968
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8810
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,...
0
7633
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5822
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
4327
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4562
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2242
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.