473,395 Members | 1,401 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,395 software developers and data experts.

Assembly version number

Hello All,

I am writing a windows service and wish to retrieve the version number of
the assembly. In a windows application, there is the Application class that
contains this information. Is there a similar method in windows services?

Landley
Jul 21 '05 #1
6 2944
http://bernardstudios.com/archive/2004/11/06/387.aspx
"Landley" <ne**@creations-software.co.uk> wrote in message
news:O1**************@TK2MSFTNGP15.phx.gbl...
Hello All,

I am writing a windows service and wish to retrieve the version number of
the assembly. In a windows application, there is the Application class
that
contains this information. Is there a similar method in windows services?

Landley

Jul 21 '05 #2
I am writing a windows service and wish to retrieve the version number of
the assembly. In a windows application, there is the Application class that
contains this information. Is there a similar method in windows services?


Assembly.GetName().Version. You can get the Assembly reference with
typeof(SomeClassInTheAssembly).Assembly or
Assembly.GetExecutingAssembly().

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 21 '05 #3
Thanks.

"David Pope" <dp***@nospam.satx.rr.com> wrote in message
news:uQ*************@TK2MSFTNGP14.phx.gbl...
http://bernardstudios.com/archive/2004/11/06/387.aspx
"Landley" <ne**@creations-software.co.uk> wrote in message
news:O1**************@TK2MSFTNGP15.phx.gbl...
Hello All,

I am writing a windows service and wish to retrieve the version number of the assembly. In a windows application, there is the Application class
that
contains this information. Is there a similar method in windows services?
Landley


Jul 21 '05 #4
Thanks.

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:eS**************@tk2msftngp13.phx.gbl...
I am writing a windows service and wish to retrieve the version number of
the assembly. In a windows application, there is the Application class thatcontains this information. Is there a similar method in windows
services?
Assembly.GetName().Version. You can get the Assembly reference with
typeof(SomeClassInTheAssembly).Assembly or
Assembly.GetExecutingAssembly().

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Jul 21 '05 #5
You might want to define the version of your service in App.config
as a key/value pair like:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="version" value="1" />
</appSettings>
</configuration>

Then use System.Configuration.ConfigurationSetting.AppSetti ngs property
to retrieve it.
"Landley" wrote:
Hello All,

I am writing a windows service and wish to retrieve the version number of
the assembly. In a windows application, there is the Application class that
contains this information. Is there a similar method in windows services?

Landley

Jul 21 '05 #6
"Landley" <ne**@creations-software.co.uk> schrieb:
I am writing a windows service and wish to retrieve the version number of
the assembly. In a windows application, there is the Application class
that
contains this information. Is there a similar method in windows services?


Structure of version numbers and methods to determine the version number
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=versioning&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Jul 21 '05 #7

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...
10
by: Simon Wallis | last post by:
I know the general purpose for the GAC is to share a component among many applications. But even when you add something to the GAC, you still have to manually create a reference to the DLL in your...
2
by: tvaidie | last post by:
Hi all I have two one signing assembly registered in GAC in two different version. I want to remove them but I don't seem able to do so. First I used gacutil.exe, failed with this error...
6
by: James | last post by:
I have two question regarding the version resource that is generated for a satellite assembly. 1) I have a file in my C# console app project called StringResources.en-US.resx. When I build the...
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...
5
by: mekim | last post by:
Hello....I am trying to System.Reflection.Assembly.GetExecutingAssembly ().GetName ().Version.ToString () ; to display the version of the app...but it remains static and therefore does not...
3
by: Richard Lewis Haggard | last post by:
I'm getting an error that should be easy but I don't understand the info structure well enough to know what's going wrong. I've been slowly adding classes and projects to a solution for a while....
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...
2
by: jtyner | last post by:
I am trying to get QFE (Quick Fix Engineering) working with an assembly installed in the GAC. I have two books that claim if two different version of the assembly are installed in the GAC -AND-...
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
0
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...
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.