ExcludeFromCodeCoverage.Fody 1.1.2

Requires NuGet 2.8 or higher.

dotnet add package ExcludeFromCodeCoverage.Fody --version 1.1.2                
NuGet\Install-Package ExcludeFromCodeCoverage.Fody -Version 1.1.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ExcludeFromCodeCoverage.Fody" Version="1.1.2">
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ExcludeFromCodeCoverage.Fody --version 1.1.2                
#r "nuget: ExcludeFromCodeCoverage.Fody, 1.1.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ExcludeFromCodeCoverage.Fody as a Cake Addin
#addin nuget:?package=ExcludeFromCodeCoverage.Fody&version=1.1.2

// Install ExcludeFromCodeCoverage.Fody as a Cake Tool
#tool nuget:?package=ExcludeFromCodeCoverage.Fody&version=1.1.2                


Fody extension to decorate public members of specific types with ExcludeFromCodeCoverageAttribute by using AOP


Just add assembly scoped attribute into solution e.g. like:

//Exclude all public members of all types in specific namespace
[assembly: AttachExcludeFromCodeCoverage("namespace")]

//Exclude all public members of all types in specific namespace and all subordinate namespaces
[assembly: AttachExcludeFromCodeCoverage("namespace.*")]

//Exclude all public members of specific type
[assembly: AttachExcludeFromCodeCoverage(typeof(SomeClass))]

//Exclude specific members of specific type
[assembly: AttachExcludeFromCodeCoverage(typeof(SomeClass), "Property")]

//Exclude members begining with 'Property' of specific type
[assembly: AttachExcludeFromCodeCoverage(typeof(SomeClass), "Property.*")]

//Exclude all public members of specific type in namespace
[assembly: AttachExcludeFromCodeCoverage("ExcludeFromCodeCoverage.Tests", "SomeClass")]

//Exclude all public members of mathching types in namespace
[assembly: AttachExcludeFromCodeCoverage("ExcludeFromCodeCoverage.Tests", "Some.*")]

//Exclude specific members of specific types in namespace
[assembly: AttachExcludeFromCodeCoverage("ExcludeFromCodeCoverage.Tests", "Some.*", "Prop.*")]

For string parameters you can use regex syntax Simple options are:

".*SomeValue" - suffixed by 
"SomeValue.*" - prefixed by

What it does

It's quite easy... Fody is an weaving tool which is one of the Aspect Oriented Techniques (AOP). Once the code is compliled Fody is taking it and modyfying it's IL code again.

This plugin is just taking AttachExcludeFromCodeCoverage attribute and is searching for all types matching the definition. All public members (methods, properties) of matching types are decorated with [ExcludeFromCodeCoverage] attribute. AttachExcludeFromCodeCoverage attribute itself is removed.

After this postcompilation intervention all decorated members are excluded from code coverage. This is highly beneficial for code that is generated by some generation tool where the developer does not have ability to influence the way how the code is generated

Why public members and not whole types?

Reason is simple... You can use partial classes and have your own logic in separate classes, so it is better to decorate individual members so that you have flexibility and have your custom code being included into code coverage analysis

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.2 7,090 9/29/2017
1.1.1 951 9/29/2017

1.1.0 - improvements, correct .net versioning, documentation
     1.1.1 - dependency issue
     1.1.2 - missing xml for syntax documentation