Using .runsettings to exclude namespaces from assemblies
Asked Answered
B

1

8

I'm trying to exclude all namespaces but Acme.Foundations.Web.Ext.Controllers from assembly Acme.Foundations.web.ext.dll. Please help create a runsettings file.

<DataCollectionRunSettings>
     <DataCollectors>
        <DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
           <Configuration>
             <CodeCoverage>
               <ModulePaths>
                 <Exclude>
                    <ModulePath>.*Ext.Helpers*</ModulePath>
                    ???
                 </Exclude>
               </ModulePaths>
             </CodeCoverage>
           </Configuration>
        </DataCollector>
     </DataCollectors>
  </DataCollectionRunSettings>

Acme.Foundations.web.ext.dll
Acme.Foundations.Web.Ext.Controllers
Acme.Foundations.Web.Ext.Helper
Acme.Foundations.Web.Ext.Models
Acme.Foundations.Web.Ext.Properties
Acme.Foundations.Web.Ext.Resources
Acme.Foundations.Web.Ext.Utilities
Acme.Foundations.Web.Ext.ViewModels
Acme.Identity.Web
Acme.Identity.Web.App_Start
Acme.Identity.Web.Identity
Acme.Utilities
System.Web.Mvc.Html
Borden answered 15/12, 2016 at 22:53 Comment(0)
V
14

You must use the Functions -> Exclude section and remove all Unwanted namespaces

Ex:

<Functions>
     <Exclude>
        <!-- Exclude everthing inside the namesapce "Acme.Foundations.Web.Ext.Helper" --> 
        <Function>^Acme.Foundations.Web.Ext.Helper\..*</Function> 
     </Exclude>  
</Functions>
Viguerie answered 3/1, 2017 at 17:39 Comment(3)
Functions is one way to do this. You can also include by path using <Source>. See more settings on Customizing Code Coverage AnalysisAcerbity
i need exclude test project assembly ?how to do thisWake
@KarthicG you can try : <ModulePaths> <Exclude> <ModulePath>Fabrikam.Math.UnitTest.dll</ModulePath> <!-- Add more ModulePath nodes here. --> </Exclude> </ModulePaths>Viguerie

© 2022 - 2024 — McMap. All rights reserved.