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

Windows Service Version

Hi,
I have windows service, in the event of an exception calling (which is
important enough to write away to a customer event log) i would like to
write away the software version as part of the evenetlog message text.

I have used the following code with existing windows forms applications
System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly
..GetExecutingAssembly.Location).FileVersion ;

but am unable to use it in a windows service due to the following compiler
error.

'System.Reflection.Assembly.GetExecutingAssembly() ' denotes a 'method'
which is not valid in the given context
So how do i accomplish this in a windows service and is it the best method
anyway.
--
--
TimB
Nov 16 '05 #1
4 5456
Tim,

Can you post the code? There should be no reason you get this error
because of the type of project it is in. It looks like a syntax error, to
say the least.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"timb" <ti**@test.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
I have windows service, in the event of an exception calling (which is
important enough to write away to a customer event log) i would like to
write away the software version as part of the evenetlog message text.

I have used the following code with existing windows forms applications
System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly .GetExecutingAssembly.Location).FileVersion ;

but am unable to use it in a windows service due to the following compiler
error.

'System.Reflection.Assembly.GetExecutingAssembly() ' denotes a 'method'
which is not valid in the given context
So how do i accomplish this in a windows service and is it the best method
anyway.
--
--
TimB

Nov 16 '05 #2
Tim,

Can you post the code? There should be no reason you get this error
because of the type of project it is in. It looks like a syntax error, to
say the least.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"timb" <ti**@test.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
I have windows service, in the event of an exception calling (which is
important enough to write away to a customer event log) i would like to
write away the software version as part of the evenetlog message text.

I have used the following code with existing windows forms applications
System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly .GetExecutingAssembly.Location).FileVersion ;

but am unable to use it in a windows service due to the following compiler
error.

'System.Reflection.Assembly.GetExecutingAssembly() ' denotes a 'method'
which is not valid in the given context
So how do i accomplish this in a windows service and is it the best method
anyway.
--
--
TimB

Nov 16 '05 #3
System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly.GetExecutingAssembly.Lo cation).FileVersion ;

Aren't you missing a set of parenthesis after GetExecutingAssembly?
System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly.GetExecutingAssembly(). Location).FileVersion ;

--
Adam Clauss
ca*****@tamu.edu
"timb" <ti**@test.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
I have windows service, in the event of an exception calling (which is
important enough to write away to a customer event log) i would like to
write away the software version as part of the evenetlog message text.

I have used the following code with existing windows forms applications
System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly
.GetExecutingAssembly.Location).FileVersion ;

but am unable to use it in a windows service due to the following compiler
error.

'System.Reflection.Assembly.GetExecutingAssembly() ' denotes a 'method'
which is not valid in the given context
So how do i accomplish this in a windows service and is it the best method
anyway.
--
--
TimB

Nov 16 '05 #4
System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly.GetExecutingAssembly.Lo cation).FileVersion ;

Aren't you missing a set of parenthesis after GetExecutingAssembly?
System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly.GetExecutingAssembly(). Location).FileVersion ;

--
Adam Clauss
ca*****@tamu.edu
"timb" <ti**@test.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,
I have windows service, in the event of an exception calling (which is
important enough to write away to a customer event log) i would like to
write away the software version as part of the evenetlog message text.

I have used the following code with existing windows forms applications
System.Diagnostics.FileVersionInfo.GetVersionInfo( System.Reflection.Assembly
.GetExecutingAssembly.Location).FileVersion ;

but am unable to use it in a windows service due to the following compiler
error.

'System.Reflection.Assembly.GetExecutingAssembly() ' denotes a 'method'
which is not valid in the given context
So how do i accomplish this in a windows service and is it the best method
anyway.
--
--
TimB

Nov 16 '05 #5

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

Similar topics

5
by: Eric Chong | last post by:
I created a Windows Service in C# that requires to get passed command arguments like a Console App. I noticed that there is an option "Start parameters" text box in the property of a Windows...
1
by: bob | last post by:
I have created a simple Windows service in VB.Net which installs fine using InstallUtil.exe to install it to, for example "c:\test", or "c:\Windows\YellowBanana", but if I install it to "c:\Program...
2
by: Fadi | last post by:
Backround: I am trying to figure out how to do the equivalant of a classic COM Local Server Singleton in .NET/C#. I created a coupld of simple Class Libs that exposes public interfaces and hosted...
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...
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: 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...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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...

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.