Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. EventLog or System.Diagnostics classes not working..

EventLog or System.Diagnostics classes not working..

Scheduled Pinned Locked Moved C#
csharpbeta-testinghelpvisual-studiotesting
3 Posts 2 Posters 21 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    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.

    A 1 Reply Last reply
    0
    • L Lost User

      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.

      A Offline
      A Offline
      Andreas Philipson
      wrote on last edited by
      #2

      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

      L 1 Reply Last reply
      0
      • A 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

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        the /r:System.dll is done automatically when you say csc class1.cs. Also I tried the second option that you told. No luck. But I got VS.NET beta 1 installed on my machine. I created a c# project, built it and its just ducky. Thanks anyways.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups