1

I am using a .runsettings file to manage the assemblies which generate code coverage results.

With the following section in my .runsettings file I get all the assemblies including my test projects some unwanted TFSBuildExtensions assemblies:

<!-- Match assembly file paths: -->
<ModulePaths>
  <Include />
  <Exclude />
</ModulePaths>

So I modified it to exclude my test projects which are all named MyCompany.MyProject1.Tests.dll

<!-- Match assembly file paths: -->
<ModulePaths>
  <Include />
  <Exclude>
    <ModulePath>.*Tests.*</ModulePath>
  </Exclude>
</ModulePaths>

However now all my assemblies are excluded and I'm left only with the TFSBuildExtensions assemblies.

What should I be specifying in the exclude section to exclude the following assemblies?

  • MyCompany.MyProject1.Tests.dll
  • ...
  • MyCompany.AnyProjectName.Tests.dll
  • TFSBuildExtensions.XXX.dll
openshac
  • 4,966
  • 5
  • 46
  • 77
  • Can you try this: `^(TFSBuildExtensions\..*\.dll)|.*Tests\.dll$` – Andrea Salicetti Nov 25 '14 at 11:10
  • OK, so I tried this but now only the TFSBuildExtensions ones are still there. E.g. tfsbuildextensions.activities.dll. Also, should I be using separate nodes as per the default MS template? – openshac Nov 25 '14 at 15:32
  • Regexp are case sensitive, unless specified otherwise. If you want to exclude tfsbuildextensions.activities.dll you should rewrite the above expression as following: ^(tfsbuildextensions\..*\.dll)|.*Tests\.dll$ Also use different ModulePath seems a good idea to me: it will help you to keep te code clear. – Andrea Salicetti Nov 26 '14 at 08:10
  • @AndreaSalicetti I have tried using the correct casing as you suggested but the tfsbuildextension.xxx.dll's are still listed in the code coverage results. I'm not even sure where it's getting them from because they aren't in my drop folder. Do you know why they are included in the results at all? – openshac Nov 26 '14 at 10:40

2 Answers2

1

OK so I found what the issue was here: https://stackoverflow.com/a/15961727/283787

The Regex is looking for a path, not just a module name, you need the .* in front of the module to ignore it – that is, you want to ignore it at any given file path.

So when I changed it to following it worked fine:

<ModulePaths>
  <Exclude>
    <ModulePath>.*tests\.dll$</ModulePath>
    <ModulePath>.*tfsbuildextensions\..*\.dll$</ModulePath>
  </Exclude>
</ModulePaths>
Community
  • 1
  • 1
openshac
  • 4,966
  • 5
  • 46
  • 77
0

This should do what you want:

<!-- Match assembly file paths: -->
<ModulePaths>
  <Include />
  <Exclude>
    <ModulePath>^.*Tests\.dll$</ModulePath>
    <ModulePath>^tfsbuildextensions\..*\.dll$</ModulePath>
  </Exclude>
</ModulePaths>
Andrea Salicetti
  • 2,423
  • 24
  • 37