How can I get Assembly Name?

T

Tom

Application.ProductName returns the root namespace. How do I get the
assembly name as displayed on the project properties dialog?

Tom
 
I

Imran Koradia

System.Reflection.Assembly.GetExecutingAssembly.GetName.Name()

hope that helps..
Imran.
 
H

Herfried K. Wagner [MVP]

Tom said:
Application.ProductName returns the root namespace. How do I get the
assembly name as displayed on the project properties dialog?

\\\
Imports System.Reflection
..
..
..
MsgBox([Assembly].GetEntryAssembly().GetName().Name)
///
 
T

Tom

Yes that helps, but dang that's long (62 characters). I was most of the
way there. You know you're on the right track if it takes more code than
VB6.
 
I

Imran Koradia

Tom said:
Yes that helps, but dang that's long (62 characters). I was most of the
way there. You know you're on the right track if it takes more code than
VB6.

lol...

You can obviously reduce the verbosity by typing an Imports statement:

Imports System.Reflection
[Assembly].GetExecutingAssembly().GetName().Name


so you see - it isn't that bad after all :)

Imran.
 
J

Jay B. Harlow [MVP - Outlook]

Tom,
Herfried & Imran answered your question.

I just wanted to point out that Application.ProductName does not return the
root namespace per se.

It actually returns the value of the AssemblyProductAttribute found in the
AssemblyInfo.vb file of your project. If you leave this attribute its
default value of blank then you do indeed get the root namespace. However if
you change the attribute's value then you will get the new value.

I normally change the AssemblyProductAttribute to a displayable value & use
Application.ProductName as my message box titles.

Note Application.ProductVersion comes from the
AssemblyInformationalVersionAttribute if you add it to your AssemblyInfo.vb
file, if you do not add AssemblyInformationalVersion, the
Application.ProductVersion comes from the AssemblyVersionAttribute:

For example, if my root namespace is "TheGreatAndWonderfulApp", I might set
my AssemblyInfo.vb file as:

....
<Assembly: AssemblyProduct("The Great & Wonderful Application")>
....
<Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyInformationalVersion("1.0")> ' Product Version

Hope this helps
Jay
 

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