Workaround for excluding assemblies from code coverage in TFS2015 build

Our build server is TFS2015 and Microsoft promises that we can customize code coverage analysis. But with runsettings setup to exclude assemblies from code coverage exceptions fail the build. Not nice.

Today we figured out how to work around this and exclude an assembly from code coverage. The key was in the msdn article; the pdb file was needed to get code coverage. Would this mean that when the pdb file was not there no code coverage was registered?

The assembly we wanted to exclude was Common.Logging. The nuget includes the pdb file for debugging purposes. We’re about to delete it in our build sequence:

delete_files

exclude_assemblies_from_code_coverage

The delete files step removes the Common.Logging.pdb before the Visual Studio Test step. Now the code coverage is not calculated for Common.Logging. Mission accomplished.

About erictummers

My work as a recruited developer changes almost every month. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s