473,323 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Windows Service Assembly Version ?

Hi,

I know how to retrieve the Assembly Version for a WinForm program :
Application.ProductVersion.

But how to do it for a windows service in C# ???

Thx for your help

G.
Jul 21 '05 #1
3 5039
> I know how to retrieve the Assembly Version for a WinForm program :
Application.ProductVersion.

But how to do it for a windows service in C# ???


The assembly version is part of the assembly's name which can be retrieved
from the FullName property. Like this:
Assembly.GetExecutingAssembly().FullName

The full name has this form:
assembly name, Version=x.x.xxxx.xxxxx, Culture=culture, PublicKeyToken=token

where assembly name is the name of the assembly
x'es are numbers (the info you are looking for)
culture is the culture the assembly is complied for, usually neutral if the
assembly is not a satelite assembly
the public key token is used for strong name assemblies.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
Jul 21 '05 #2
Thx for your answer.

I found another tip how to retrieve it :

System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly.GetExecutingAssembly(). Location).FileVersion;
What do you think about this one ?

G.

"Anders Norås [MCAD]" <an**********@objectware.no> wrote in message
news:e3**************@TK2MSFTNGP10.phx.gbl...
I know how to retrieve the Assembly Version for a WinForm program :
Application.ProductVersion.

But how to do it for a windows service in C# ???


The assembly version is part of the assembly's name which can be retrieved
from the FullName property. Like this:
Assembly.GetExecutingAssembly().FullName

The full name has this form:
assembly name, Version=x.x.xxxx.xxxxx, Culture=culture,
PublicKeyToken=token

where assembly name is the name of the assembly
x'es are numbers (the info you are looking for)
culture is the culture the assembly is complied for, usually neutral if
the assembly is not a satelite assembly
the public key token is used for strong name assemblies.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/

Jul 21 '05 #3
> System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly.GetExecutingAssembly(). Location).FileVersion;
What do you think about this one ?

The above code does something different. It looks up version information for
the file not the assembly. This information might be the same, but using
this approach will require your application to have access to the filesystem
including rights to read the assembly.
Unless you need some of the additional information that the FileVersionInfo
class can give you such as CompanyName, ProductName and so on I recommend
that you retrieve the assembly version from the assembly it self.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
Jul 21 '05 #4

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

Similar topics

2
by: Mark | last post by:
I created an extremely simple windows service that only writes to the EventLogs on Stop and Pause. I installed it using the InstallUtil.exe program, the output of which is below. It appears to be...
7
by: Larry Bird | last post by:
I have a windows service that want to un-install. When I run "installutil /u serivcename" I get the error that the serivce is not installed on my machine. However, when view the serivce console I...
3
by: Amjad | last post by:
Hi, I just wrote a test Windows Service that creates a text file on startup (please see my code below). The file is never created. Protected Overrides Sub OnStart(ByVal args() As String) Dim...
4
by: Blaxer | last post by:
I have read approximately 30 articles now on various methods to make your vb.net application automatically update itself and I can't see how they apply to a vb.net windows services projects. The...
2
by: Amongin Ewinyu | last post by:
Hi, I'm trying to create a Windows service programmatically that will do the following: - When a user logs on, it will automatically run a service that uses BITS (Background Intelligent...
1
by: bmaheswar | last post by:
Hi, I have a windows service. it is developed using .Net Framework 1.0. When i try to run that service using CLR PRofile 1.0. Profiler Throws error as show below. See the end of this message...
0
by: pratika2002 | last post by:
Hi, I am having a windows service project which is built by someone else and I have to understand the fuctionality. While running the service I am getting the following exception. "An unhandled...
0
by: savajx1 | last post by:
I am loading signed assemblies from a network share. The assemblies are NOT INSTALLED in the GAC as they are part of an enterprise distributed application implemented as a windows service that...
0
by: =?Utf-8?B?U2ltb25EZXY=?= | last post by:
Hi All I would like to install the same Windows Service project on the same server under different names, one for each customer. I have been able to do it but I would like an expert opinion as...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.