473,668 Members | 2,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Diagnost ics.FileVersion Info.GetVersion Info(System.Ref lection.Assembl y
..GetExecutingA ssembly.Locatio n).FileVersion ;

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

'System.Reflect ion.Assembly.Ge tExecutingAssem bly()' 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 5470
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.co m

"timb" <ti**@test.co m> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.Diagnost ics.FileVersion Info.GetVersion Info(System.Ref lection.Assembl y .GetExecutingAs sembly.Location ).FileVersion ;

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

'System.Reflect ion.Assembly.Ge tExecutingAssem bly()' 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.co m

"timb" <ti**@test.co m> wrote in message
news:%2******** ********@TK2MSF TNGP12.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.Diagnost ics.FileVersion Info.GetVersion Info(System.Ref lection.Assembl y .GetExecutingAs sembly.Location ).FileVersion ;

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

'System.Reflect ion.Assembly.Ge tExecutingAssem bly()' 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.Diagnost ics.FileVersion Info.GetVersion Info(System.Ref lection.Assembl y.GetExecutingA ssembly.Locatio n).FileVersion ;

Aren't you missing a set of parenthesis after GetExecutingAss embly?
System.Diagnost ics.FileVersion Info.GetVersion Info(System.Ref lection.Assembl y.GetExecutingA ssembly().Locat ion).FileVersio n ;

--
Adam Clauss
ca*****@tamu.ed u
"timb" <ti**@test.co m> wrote in message news:%2******** ********@TK2MSF TNGP12.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.Diagnost ics.FileVersion Info.GetVersion Info(System.Ref lection.Assembl y
.GetExecutingAs sembly.Location ).FileVersion ;

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

'System.Reflect ion.Assembly.Ge tExecutingAssem bly()' 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.Diagnost ics.FileVersion Info.GetVersion Info(System.Ref lection.Assembl y.GetExecutingA ssembly.Locatio n).FileVersion ;

Aren't you missing a set of parenthesis after GetExecutingAss embly?
System.Diagnost ics.FileVersion Info.GetVersion Info(System.Ref lection.Assembl y.GetExecutingA ssembly().Locat ion).FileVersio n ;

--
Adam Clauss
ca*****@tamu.ed u
"timb" <ti**@test.co m> wrote in message news:%2******** ********@TK2MSF TNGP12.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.Diagnost ics.FileVersion Info.GetVersion Info(System.Ref lection.Assembl y
.GetExecutingAs sembly.Location ).FileVersion ;

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

'System.Reflect ion.Assembly.Ge tExecutingAssem bly()' 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
7169
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 Service in MMC. Is there any way to get arguments using this option? If possible, what framework method should I use to get an arguement? Thanks in advance. Eric
1
3265
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 Files\Test" it installs ok but will not start (no useful error message is given other than the usual annoying suggestion about having sufficient privileges). The problem only seems to happen with spaces, not long filenames. I have found a...
2
7273
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 them in a Windows Forms EXE. Create a Windows Forms client and both the Client and the Host EXEs configure the remoting protocols through respective .config files. Problem: I want to change the host from an Win Forms EXE to a Windows Service.
7
7938
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 still see my service there. What must be done to remove a windows service written in VB.Net from my system. I'm trying un-install the service because I'm compiling it as a console application to perform debugging. I think it will be easier to...
3
14913
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 swLog As StreamWriter = File.CreateText("C:\myLog.txt") swLog.WriteLine("My Windows Service has just started.") swLog.Close() : swLog.Flush() End Sub
4
5588
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 goal of the project is to write a windows service in vb.net that runs on many workstations that can automatically update itself from a central web server or share (either or doesn’t matter). I do not want the service to re-install itself each time...
1
3389
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 for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text **************
0
1519
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 loads its code (*.dlls/assemblies) from a network share. The assemblies are signed to allow loading given code access security. I am debugging the windows service but I cannot get it to release/replace a copy of an old version of the *.dll. I...
5
3296
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? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
0
8462
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8893
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...
1
8586
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
8658
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7405
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
6209
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
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.