Bill Wang’s Blog

October 31, 2008

How to configure tests based on build configuration

Filed under: Uncategorized — Tags: — Bill @ 11:52 am

Team build provides ability to build both Release and Debug bits in the same build. If there are unit tests, it will run tests for both Release bits and Debug bits. Sometimes, we might want to run tests or use run configure files based on the build configuration. For example, you might want to get code coverage for the Debug build, while you don’t want to instrument the Release build.

The target CoreTestConfiguration in the team build runs for each build configuration. So, we can override target BeforeTestConfiguration to set properties used by TestToolsTask based on build configuration.

The following code demonstrate how to parse in test run configure file based on the build configureation:

<Target Name=”BeforeTestConfiguration”>
<PropertyGroup Condition=”‘$(Configuration)’==’Debug'”>
<PropertyGroup Condition=”‘$(Configuration)’==’Release'”>


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

Create a free website or blog at

%d bloggers like this: