EventLog or System.Diagnostics classes not working..
-
Hai, I was testing the following code... But i get an error saying... "The type or namespace name 'EventLog' does not exist in the class or namespace 'WriteToAnEventLog_csharp'." Why is this so? What part am I missing? I am not using VS.NET Beta. I am using notepad to type this text and used, csc test.cs to compile the code. Please help me.... using System; using System.Diagnostics; namespace WriteToAnEventLog_csharp { /// /// Summary description for Class1. /// class Class1 { static void Main(string[] args) { string sSource; string sLog; string sEvent; sSource = "dotNET Sample App"; sLog = "Application"; sEvent = "Sample Event"; if (!EventLog.SourceExists(sSource)) EventLog.CreateEventSource(sSource,sLog); EventLog.WriteEntry(sSource,sEvent); EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning, 234); } } } Thanks.
-
Hai, I was testing the following code... But i get an error saying... "The type or namespace name 'EventLog' does not exist in the class or namespace 'WriteToAnEventLog_csharp'." Why is this so? What part am I missing? I am not using VS.NET Beta. I am using notepad to type this text and used, csc test.cs to compile the code. Please help me.... using System; using System.Diagnostics; namespace WriteToAnEventLog_csharp { /// /// Summary description for Class1. /// class Class1 { static void Main(string[] args) { string sSource; string sLog; string sEvent; sSource = "dotNET Sample App"; sLog = "Application"; sEvent = "Sample Event"; if (!EventLog.SourceExists(sSource)) EventLog.CreateEventSource(sSource,sLog); EventLog.WriteEntry(sSource,sEvent); EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning, 234); } } } Thanks.
What command line parameters are you using? you have to use the /r:System.dll to get it to compile... try this: csc /target:winexe /out:eventlog.exe class1.cs /r:system.dll Andreas Philipson
-
What command line parameters are you using? you have to use the /r:System.dll to get it to compile... try this: csc /target:winexe /out:eventlog.exe class1.cs /r:system.dll Andreas Philipson