Windows Service Version

  • Thread starter Thread starter timb
  • Start date Start date
T

timb

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.
 
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.
 
System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly.Location).FileVersion ;

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