0

I am trying to exclude the class or method from configuration file ( *.psproj file ) for specific project. but it is not excluding, What went wrong. Please correct me. Please find the attachment of psproj config file.I am using two version of postsharp 4.3.23 and 3.1.46 but using same psproj structure.

*.psproj

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration" xmlns:d="clr-namespace:LCLogger;assembly:LCLogger" >
    <Multicast>
        <d:TraceLog AttributeTargetElements="Method"
             AttributeTargetTypeAttributes="Public|Internal|Private|UserGenerated"
             AttributeTargetMemberAttributes="Public|Internal|Private|UserGenerated"
             AttributeTargetMembers="*"> <!--can use regex: for TargetAssemblies and TargetMembers -->
        </d:TraceLog>
        <d:TraceLog AttributeExclude="True"
            AttributeTargetMembers="regex:get_.*|set_.*">
        </d:TraceLog>

        <!-- Exclude all methods of class -->

    <d:TraceLog AttributeExclude="True"
            AttributeTargetElements="Method"
            AttributeTargetTypeAttributes="regex:SomeClass1|SomeClass2"
            AttributeTargetMembers="*">
        </d:TraceLog>

    <!-- Exclude specific methods of class -->

    <d:TraceLog AttributeExclude="True"
            AttributeTargetElements="Method"
            AttributeTargetTypeAttributes="SomeClass"
            AttributeTargetMembers="regex:SomeMethod">
        </d:TraceLog>
    </Multicast>

  • You have quite obvious problems in the code sample: 1) AttributeTargetTypeAttributes should not contain regex with CLASS name. 2) Type names should include the namespace, i.e. regex should expect a namespace. 3) You should use AttributeTargetTypes for specifying target types. – Daniel Balas Jun 21 '17 at 12:27
  • Thanks Balas. Let me try you suggestion.Should we need to do any implementation for code level for psproj file ? – Kumar Manish Jun 28 '17 at 05:45

0 Answers0