TraceSwitch

N

nhmark64

Hi,

When i run testapp.exe the testapp.exe.config file i have in the
DEBUG directory gets deleted, and the TraceSwitch in my code never
gets set.

testapp.exe.config
____________________
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<switches>
<add name="GlobalTrace" value="3" />
</switches>
</system.diagnostics>
</configuration>
_____________________

C# code
_____________________
public static System.Diagnostics.TraceSwitch
generalSwitch =
new
System.Diagnostics.TraceSwitch("GlobalTrace", "Entire Application");
_____________________

What am i doing wrong? I am trying to get generalSwitch.TraceVerbose
set to true for debugging through an XML file.


Thanks,
Mark
 
F

Frans Bouma [C# MVP]

Hi,

When i run testapp.exe the testapp.exe.config file i have in the
DEBUG directory gets deleted, and the TraceSwitch in my code never
gets set.

testapp.exe.config
____________________
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<switches>
<add name="GlobalTrace" value="3" />
</switches>
</system.diagnostics>
</configuration>
_____________________

C# code
_____________________
public static System.Diagnostics.TraceSwitch
generalSwitch =
new
System.Diagnostics.TraceSwitch("GlobalTrace", "Entire Application");
_____________________

What am i doing wrong? I am trying to get generalSwitch.TraceVerbose
set to true for debugging through an XML file.

Silly question from my part: do you have an app.config in your C#
project? If not, add one and add your configuration xml to that config
file. When building your app, the app.config file will become
testapp.exe.config.

For the rest, your setup looks ok at first glance.

FB

--
 
N

nhmark64

That was the problem. Thanks very much!
Mark


Silly question from my part: do you have an app.config in your C#
project? If not, add one and add your configuration xml to that config
file. When building your app, the app.config file will become
testapp.exe.config.

For the rest, your setup looks ok at first glance.

FB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top