BizTalk –Unit Testing Enabled in Release mode?

Today I ran into something which took me too much time to figure out, so this blog post is to avoid others to waste their time. In the end the solution was pretty simple, although not very obvious.

I’m working on a project which consists of 15 BizTalk applications. These applications are deployed using the BizTalk Deployment Framework. I tested the deployments on my development environment and everything worked as expected.

When I deployed it to the test environment, I experienced an issue with just one of the applications. It mentioned a missing dependency: Microsoft.BizTalk.TestTools.

This is the assembly that is added as a reference to your Visual Studio project when you enable unit testing in the project properties (http://msdn.microsoft.com/en-us/library/dd257907(v=bts.10).aspx). I always thought this was bound to building the solution in Debug mode and since the BizTalk Deployment Framework builds everything in Release mode, the reference should have been dropped.

Why did this only show up at this particular project?

I checked the assembly with ILSpy and found out the reference to Microsoft.BizTalk.TestTools actually was there, while it was built in Release mode. The first thing I did was checking the configuration manager, to make sure the Test project was left out in Release mode, but this was already the case.

Finally I found out that if you pull up the project properties, the settings are dependent on the Debug or Release mode you’ve selected. So it appeared that I accidentally enabled unit testing while the configuration was in Release mode. When I disabled it for Release, leaving it enabled for Debug, everything deployed fine.

It is good to know not all debug and test related settings are only bound to Debug builds, so be aware they might show up in your Release build.

Didago IT Consultancy