472,992 Members | 3,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 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 2116
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Terence Shek | last post by:
Is there a way to set the application binding policy so that it always binds to the latest version of an assembly? I'm hoping there is a way to avoid updating the application's binding...
3
by: Michael Bøcker-Larsen | last post by:
Hi I'v been stuck on this problem for ages now. I have found that I'm not the only one with this problem, by looking through the different newsgroups. Hope you can help me! I know there is a...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
1
by: Andrew | last post by:
In ASP.NET 1.1 I used to retreive the version of my code-behind assembly using following syntax: Assembly.GetExecutingAssembly().GetName().Version The version was defined in AssemblyInfo.cs using...
7
by: R Reyes | last post by:
Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? I'm trying to manipulate MS Word from my Web Form application and I can't get passed...
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
5
by: Laurence | last post by:
In VS.2005 using VB.NET There are two versions on every project, The Assembly Version and the File Version. Why are there two different versions? As far as I can tell, there is not need for...
1
by: Coaster | last post by:
orig ref here http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/ff29cc370678911d/c0db5b7e3da283b9?lnk=st&q=gac+assembly+new+version&rnum=7#c0db5b7e3da283b9...
1
by: nish85 | last post by:
Hi, i have uploaded my sit to web server goddady.com i have a button to download dyanmically generated excel file.This button is ajax enabled.....When i am click on this button it will popup a...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.