Assembly Version

J

Johnny Jörgensen

Does anybody knopw how to get the version number of the executing assembly.

System.Reflection.Assembly.GetExecutingAssembly contains a lot of info about
the current assembly, but as far as I can see not the version number...

TIA,
Johnny J.
 
K

kimiraikkonen

Does anybody knopw how to get the version number of the executing assembly..

System.Reflection.Assembly.GetExecutingAssembly contains a lot of info about
the current assembly, but as far as I can see not the version number...

TIA,
Johnny J.
Try this:

My.Application.Info.Version.ToString
 
J

Johnny Jörgensen

No, that returns the version info of the current APPLICATION - not the
current Assembly.

I want the version number of the dll that contains the method in which I
need the version number. And that version is not the same as the application
version.

/Johnny J.



"kimiraikkonen" <[email protected]> skrev i meddelandet
Does anybody knopw how to get the version number of the executing
assembly.

System.Reflection.Assembly.GetExecutingAssembly contains a lot of info
about
the current assembly, but as far as I can see not the version number...

TIA,
Johnny J.
Try this:

My.Application.Info.Version.ToString
 
K

kimiraikkonen

No, that returns the version info of the current APPLICATION - not the
current Assembly.

I want the version number of the dll that contains the method in which I
need the version number. And that version is not the same as the application
version.

/Johnny J.





Try this:

My.Application.Info.Version.ToString

In solution when i right click your app -> properties -> Assembly
Information -> Look at the section named "assembly version", when i
tried:

My.Application.Info.Version.ToString

returned the version within that "assembly version" section.

Maybe you meant another thing, sorry.
 
K

kimiraikkonen

No, that returns the version info of the current APPLICATION - not the
current Assembly.

I want the version number of the dll that contains the method in which I
need the version number. And that version is not the same as the application
version.

/Johnny J.





Try this:

My.Application.Info.Version.ToString

However you may need this returns the same version:

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
 
J

Johnny Jörgensen

Thanks! This was what I needed - I couldn't figure out that GetName returned
something useful.

For the record: The two calls do NOT return the same thing. To clarify it:
In my solution, I have TWO projects. One containing the EXE itself (let's
say the version of the exe is 2.3 for instance) and another project which is
a DLL that is referenced by the EXE project (let's say the version of the
dll is 5.6 for instance).

If you have a method in the dll that need to check the DLL version, you will
get the right result (5.6) with

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()

But

My.Application.Info.Version.ToString

will return 2.3

However, thanks for the help!
Johnny J.





"kimiraikkonen" <[email protected]> skrev i meddelandet
No, that returns the version info of the current APPLICATION - not the
current Assembly.

I want the version number of the dll that contains the method in which I
need the version number. And that version is not the same as the
application
version.

/Johnny J.

"kimiraikkonen" <[email protected]> skrev i
meddelandet



Try this:

My.Application.Info.Version.ToString

However you may need this returns the same version:

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()
 
K

kimiraikkonen

Thanks! This was what I needed - I couldn't figure out that GetName returned
something useful.

For the record: The two calls do NOT return the same thing. To clarify it:
In my solution, I have TWO projects. One containing the EXE itself (let's
say the version of the exe is 2.3 for instance) and another project which is
a DLL that is referenced by the EXE project (let's say the version of the
dll is 5.6 for instance).

If you have a method in the dll that need to check the DLL version, you will
get the right result (5.6) with

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()

But

My.Application.Info.Version.ToString

will return 2.3

However, thanks for the help!
Johnny J.

"kimiraikkonen" <[email protected]> skrev i meddelandet






However you may need this returns the same version:

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()

OK, thanks for information, glad you solved :)
 
J

Just_a_fan

Could you use this?

Me.Text = Me.Text & " v" & My.Application.Info.Version.Major & "." &
My.Application.Info.Version.Minor

If you go further, you start getting what seem to be random numbers
including negative numbers for some of the levels. I don't think a
negative number would ever be correct for a version tier!

But that's just my opinion...

Mike
 

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