I upgraded some legacy console application from .NET 2.0 to .NET 4.0. I am getting a runtime error on the first line of Main() that “type is not a recognized attribute”. It is originating from the .exe.config file in the following section:
<listeners>
<add name="RHIOListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\Htp\RHIOListener.log"/>
<remove type="System.Diagnostics.DefaultTraceListener"/>
</listeners>
The problem is with the “remove type” line. It looks like the attribute should be “name” instead. I’m not sure what to do. There doesn’t seem to be an explicitly created, “named” DefaultTraceListener. Is this line even necessary?
You can’t remove by
type, you have to do it byname.Error message is because, according to .config schema, the only attribute allowed for
removenode isname. Try one of the following:Or: