G
Guest
Hello,
Thanks for reviewing my question. I am trying to understand how to use a
configuration file for my application, so I can turn debug or trace with a
switch. The following is what I put together from my understanding but
doesn't work.
AssemblyInfo.cs
------------------
[assembly: AssemblyConfiguration("RegConsole.xml")]
RegConsole.xml
------------------
<configuration>
<system.diagnostics>
<switches>
<add name="mySwitch" value="4" />
</switches>
</system.diagnostics>
</configuration>
RegConsole.exe
------------------
static TraceSwitch mySwitch = new TraceSwitch("General", "Entire
Application");
static public void Main()
{
if(mySwitch.TraceError)
Console.WriteLine("My error message.");
if(mySwitch.TraceVerbose)
Console.WriteLine("My second error message.");
}
Many Thanks
Peter
Thanks for reviewing my question. I am trying to understand how to use a
configuration file for my application, so I can turn debug or trace with a
switch. The following is what I put together from my understanding but
doesn't work.
AssemblyInfo.cs
------------------
[assembly: AssemblyConfiguration("RegConsole.xml")]
RegConsole.xml
------------------
<configuration>
<system.diagnostics>
<switches>
<add name="mySwitch" value="4" />
</switches>
</system.diagnostics>
</configuration>
RegConsole.exe
------------------
static TraceSwitch mySwitch = new TraceSwitch("General", "Entire
Application");
static public void Main()
{
if(mySwitch.TraceError)
Console.WriteLine("My error message.");
if(mySwitch.TraceVerbose)
Console.WriteLine("My second error message.");
}
Many Thanks
Peter