473,748 Members | 3,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assembly: version

I'm trying to retrieve the version attribute of the current assembly in
Console and Service applications. I've tried the following method but it
doesn't work for me. Any ideas:

' Return the assembly's Version attribute value.
Public Function GetAssemblyVers ion() As String
Dim m_MyAssembly As [Assembly] = [Assembly].GetExecutingAs sembly

If m_MyAssembly.Is Defined(GetType (AssemblyVersio nAttribute), True) Then
Dim attr As Attribute = _
Attribute.GetCu stomAttribute(m _MyAssembly,
GetType(Assembl yVersionAttribu te))
Dim version_attr As AssemblyVersion Attribute = DirectCast(attr ,
AssemblyVersion Attribute)
Return version_attr.Ve rsion.ToString
Else
Return ""
End If
End Function
TIA

Russ
Nov 21 '05 #1
1 1324
Try this:

Dim objAssembly As System.Reflecti on.Assembly =
System.Reflecti on.Assembly.Get ExecutingAssemb ly
Dim objVersion As Version = objAssembly.Get Name.Version

System.Diagnost ics.Debug.Write Line(objVersion .ToString)

hth

~Ben

"Russ Green" <ma*****@SPAM-russgreen.com> wrote in message
news:ew******** ******@TK2MSFTN GP10.phx.gbl...
I'm trying to retrieve the version attribute of the current assembly in
Console and Service applications. I've tried the following method but it
doesn't work for me. Any ideas:

' Return the assembly's Version attribute value.
Public Function GetAssemblyVers ion() As String
Dim m_MyAssembly As [Assembly] = [Assembly].GetExecutingAs sembly

If m_MyAssembly.Is Defined(GetType (AssemblyVersio nAttribute), True) Then
Dim attr As Attribute = _
Attribute.GetCu stomAttribute(m _MyAssembly,
GetType(Assembl yVersionAttribu te))
Dim version_attr As AssemblyVersion Attribute = DirectCast(attr ,
AssemblyVersion Attribute)
Return version_attr.Ve rsion.ToString
Else
Return ""
End If
End Function
TIA

Russ

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8808
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 configuration every time there is an update to a shared assembly.
10
3478
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 somewhere that each folder under the "web site" is compiled in separate assembly. I however, did not find that the "web site" creation in vs.net 2005 created any AssemblyInfo.cs file.
7
10962
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 this screen below. Please help, thanks in advance... Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify...
3
4411
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 really understand how this could be an issue. The assemblies that the system is complaining about are ones that we build here and we're not changing version numbers on anything. The errors come and go with no apparent rhyme or reason. We do not...
1
2256
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 I have pasted the part I'm interested in below. My company doesn't use versioning or the gac and I'd like to. We're on vs.net 2005 & .net 2., is this still true or has it changed since then? thanks That article is not entirely accurate. ...
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8243
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.