Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding References without Visual Studio

I am trying to learn log4Net, however, I do not have Visual Studio installed in my PC (due to lack of Administrative Privileges). And so, I am trying out my code by writing them in good old Notepad of Windows XP. In this, if I want to add a reference to log4net.dll, how do I do it?

Sorry for being .NET naive. I am just learning!

For instance, this is the sample code that I am trying to execute. Tutorial is available here.

using System;   
namespace Tutorial1_GettingStarted   
{   
 class Program   
 {   
     static void Main( string[] args )   
     {   
      log4net.Config.BasicConfigurator.Configure();   
      log4net.ILog log = log4net.LogManager.GetLogger( typeof( Program ) );              

        log.Debug( "Hello World!" );   
        log.Info( "I'm a simple log4net tutorial." );   
        log.Warn( "... better be careful ..." );   
        log.Error( "ruh-roh: an error occurred" );   
        log.Fatal( "OMG we're dooooooomed!" );   

        Console.ReadLine();  // so you can read the output   
    }   
  }   
}  
like image 649
Kanini Avatar asked Oct 14 '10 06:10

Kanini


1 Answers

When you compile, use the /r switch:

csc Program.cs /r:Log4Net.dll
like image 168
Jon Skeet Avatar answered Oct 20 '22 12:10

Jon Skeet