To get logging working without pesky WMI/Performance counter errors on every logged event:

Per Tom Hollander’s weblog

Go to the Logging project, Project Properties dialog for the Common project, and under Configuration Properties\Build, find the Conditional Compilation Properties property and remove ;USEWMI;USEPERFORMANCECOUNTER for the build type you’re interested in (ReleaseFinal, in this case).

Ignore compile warnings about DB2 goop.

Delete any old project references and re-add reference to new version in C:\Program Files\Microsoft Enterprise Library\src\Logging\bin\ReleaseFinal.

Then add an appropriate using statement and use in code:

using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using Microsoft.Practices.EnterpriseLibrary.Logging; using Microsoft.Practices.EnterpriseLibrary.Logging.Tracing;   namespace CAESDO {     ///\     /// Summary description for WebForm1.     ///\     public class DefaultPage : System.Web.UI.Page     {         private void Page\_Load(object sender, System.EventArgs e)         {             // Put user code to initialize the page here             LogEntry logEntry = new LogEntry();             logEntry.Message = “Starting up the application”;             Logger.Write(logEntry);               // Now this is cool! Tracing flow of code through application             // and it was simple to add an EmailAlert with an EmailSink               using (new Tracer(“Trace”))             {                 Logger.Write(“Hello world”);                 Logger.Write(“Hello by e-mail”, “EmailAlerts”,5,3000,Microsoft.Practices.EnterpriseLibrary.Logging.Severity.Information, “An e-mail message logging all kinds of stuff”);             }           }           \#region Web Form Designer generated code         override protected void OnInit(EventArgs e)         {             //             // CODEGEN: This call is required by the ASP.NET Web Form Designer.             //             InitializeComponent();             base.OnInit(e);         }           ///\         /// Required method for Designer support - do not modify         /// the contents of this method with the code editor.         ///\         private void InitializeComponent()         {                this.Load += new System.EventHandler(this.Page\_Load);         }         \#endregion     } }


It’d sure make it easier to post code to my weblog if VisualStudio 2005 included CopySourceAsHtml functionality. This is a great application, too bad it doesn’t work for me. I seem to have uncovered the first interaction between CSAH and a trial VisualPerl installation that won’t uninstall.

Par for the course.

Although, I’ve suggested to the Visual Studio 2005 guys that they add this feature.

P.S. Collin worked to fix CSAH, and I nuked and reinstalled my system, including Visual Studio 2003.NET. That seems to have done the trick.