471,356 Members | 1,607 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,356 software developers and data experts.

How to get the exact Assembly Version

Hi,
I need to get the exact AssemblyVersion.
I tried to use something like:

string appName =
System.Reflection.Assembly.GetAssembly(this.GetTyp e()).Location;
System.Reflection.AssemblyName assemblyName =
System.Reflection.AssemblyName.GetAssemblyName(app Name);
return assemblyName.Version.ToString();

The problem with this code is that for 2 different versions such as:
"1.0001.0001.0076"
and
"1.1000.0001.0076"

I will get the same result:
"1.1.1.76"

Is it possible to get the "full" version string ?

thanks,
Yoav.


Sep 10 '08 #1
4 2065
The problem with this code is that for 2 different versions such as:
"1.0001.0001.0076"
and
"1.1000.0001.0076"
Really? It might strip *leading* zeros, but the second appears as
"1.1000.1.76" for me.

Unfortunately, AssemblyVersionAttribute is removed from the generated
assembly, so you can't use Attribute.GetCustomAttribute() to get the
original text; I suspect you probably have to accept the way it
behaves. Sorry...

Marc
Sep 10 '08 #2
On 10 Sep, 10:45, "Yoavo" <y...@cimatron.co.ilwrote:
Hi,
I need to get the exact AssemblyVersion.
I tried to use something like:

string appName =
System.Reflection.Assembly.GetAssembly(this.GetTyp e()).Location;
System.Reflection.AssemblyName assemblyName =
System.Reflection.AssemblyName.GetAssemblyName(app Name);
return assemblyName.Version.ToString();

The problem with this code is that for 2 different versions such as:
"1.0001.0001.0076"
and
"1.1000.0001.0076"

I will get the same result:
"1.1.1.76"

Is it possible to get the "full" version string ?

thanks,
Yoav.
Hi Yoav,

I was just trying to understand what is the difference between

Version 1.1.1.76 which spells MajorVersion 1, MajorRevision
1, MinorVesion 1, MinorRevision 76
Version 1.0001.0001.0076 which spells MajorVersion 1, MajorRevision
1, MinorVesion 1, MinorRevision 76

I think both are one and the same... How many zeros you add before a
number does not really effect the semantics.

The problem with this code is that for 2 different versions such as:
"1.0001.0001.0076"
and
"1.1000.0001.0076"

I will get the same result:
"1.1.1.76"
for the second case you are supposed to get 1.1000.1.76. I suggest you
check out the assembly version

-Cnu.

Sep 10 '08 #3
Sorry, my mistake.
I get "1.1000.1.76." as you said...

"Duggi" <Du***************@gmail.comwrote in message
news:0a**********************************@8g2000hs e.googlegroups.com...
On 10 Sep, 10:45, "Yoavo" <y...@cimatron.co.ilwrote:
>Hi,
I need to get the exact AssemblyVersion.
I tried to use something like:

string appName =
System.Reflection.Assembly.GetAssembly(this.GetTy pe()).Location;
System.Reflection.AssemblyName assemblyName =
System.Reflection.AssemblyName.GetAssemblyName(ap pName);
return assemblyName.Version.ToString();

The problem with this code is that for 2 different versions such as:
"1.0001.0001.0076"
and
"1.1000.0001.0076"

I will get the same result:
"1.1.1.76"

Is it possible to get the "full" version string ?

thanks,
Yoav.

Hi Yoav,

I was just trying to understand what is the difference between

Version 1.1.1.76 which spells MajorVersion 1, MajorRevision
1, MinorVesion 1, MinorRevision 76
Version 1.0001.0001.0076 which spells MajorVersion 1, MajorRevision
1, MinorVesion 1, MinorRevision 76

I think both are one and the same... How many zeros you add before a
number does not really effect the semantics.

>The problem with this code is that for 2 different versions such as:
"1.0001.0001.0076"
and
"1.1000.0001.0076"

I will get the same result:
"1.1.1.76"

for the second case you are supposed to get 1.1000.1.76. I suggest you
check out the assembly version

-Cnu.

Sep 10 '08 #4
On Sep 10, 12:09*pm, "Yoavo" <y...@cimatron.co.ilwrote:
Sorry, my mistake.
I get "1.1000.1.76." as you said...

"Duggi" <DuggiSrinivasa...@gmail.comwrote in message

news:0a**********************************@8g2000hs e.googlegroups.com...
On 10 Sep, 10:45, "Yoavo" <y...@cimatron.co.ilwrote:
Hi,
I need to get the exact AssemblyVersion.
I tried to use something like:
string appName =
System.Reflection.Assembly.GetAssembly(this.GetTyp e()).Location;
System.Reflection.AssemblyName assemblyName =
System.Reflection.AssemblyName.GetAssemblyName(app Name);
return assemblyName.Version.ToString();
The problem with this code is that for 2 different versions such as:
"1.0001.0001.0076"
and
"1.1000.0001.0076"
I will get the same result:
"1.1.1.76"
Is it possible to get the "full" version string ?
thanks,
Yoav.
Hi Yoav,
I was just trying to understand what is the difference between
Version 1.1.1.76 * * * * *which spells MajorVersion 1, MajorRevision
1, MinorVesion 1, MinorRevision 76
Version 1.0001.0001.0076 *which spells MajorVersion 1, MajorRevision
1, MinorVesion 1, MinorRevision 76
I think both are one and the same... How many zeros you add before a
number does not really effect the semantics.
The problem with this code is that for 2 different versions such as:
"1.0001.0001.0076"
and
"1.1000.0001.0076"
I will get the same result:
"1.1.1.76"
for the second case you are supposed to get 1.1000.1.76. I suggest you
check out the assembly version
-Cnu.
So its working as expected!!!
Thanks.

-Cnu

Sep 10 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by jojobar | last post: by
1 post views Thread by Andrew | last post: by
7 posts views Thread by R Reyes | last post: by

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.