473,406 Members | 2,220 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,406 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 5056
> 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.