.NETGURU
Version Info in c# assembly
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcs' list.


MOORE, Fergal, GCM
Does anyone know if it is possible to get access to the assembly version
from code within that assembly?
Thx,
    - Fergal Moore
Reply to this message...
 
    
Brian W. Spolarich

This took a little hunting to figure out:

using System.Reflection;
using System.Diagnostics;

Assembly assembly =3D Assembly.GetExecutingAssembly();
FileVersionInfo FVI =3D =
FileVersionInfo.GetVersionInfo(assembly.Location);
=20
You can then inspect the FileVersionInfo properties. =
FileVersionInfo.Version is the composite form, which in turn is broken =
out as (from the VS.NET docs):

'Typically, a version number is displayed as "major number.minor =
number.build number.private part number". A file version number is a =
64-bit number that holds the version number for a file as follows:=20

-The first 16 bits are the FileMajorPart number.=20
-The next 16 bits are the FileMinorPart number.=20
-The third set of 16 bits are the FileBuildPart number.=20
-The last 16 bits are the FilePrivatePart number.'

These are available as separate properties too.

Regards,

-bws

-----Original Message-----
From: MOORE, Fergal, GCM [mailto:Click here to reveal e-mail address]
Sent: Wednesday, July 24, 2002 12:19 PM
To: aspngcs
Subject: [aspngcs] Version Info in c# assembly

Does anyone know if it is possible to get access to the assembly version =
from code within that assembly?=20
Thx,=20
- Fergal Moore=20
| [aspngcs] member Click here to reveal e-mail address =3D YOUR ID | =
http://www.asplists.com/asplists/aspngcs.asp =3D JOIN/QUIT=20

Reply to this message...
 
    
Kevin Burton
Assembly a = Assembly.GetExecutingAssembly();
AssemblyName an = a.GetName();
an.Version;

Kevin Burton

-----Original Message-----
From: MOORE, Fergal, GCM [mailto:Click here to reveal e-mail address]
Sent: Wednesday, July 24, 2002 11:19 AM
To: aspngcs
Subject: [aspngcs] Version Info in c# assembly

Does anyone know if it is possible to get access to the assembly version
from code within that assembly?
Thx,
- Fergal Moore
| [aspngcs] member Click here to reveal e-mail address = YOUR ID |
http://www.asplists.com/asplists/aspngcs.asp = JOIN/QUIT
Reply to this message...
 
 
System.Diagnostics.FileVersionInfo
System.Reflection.Assembly
System.Reflection.AssemblyName




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification