Posts Tagged BizTalk VSTS

New BizTalk articles on TechNet Wiki

Here are a few TechNet Wiki articles that have become available recently. I have usually found it difficult to find relevant content on the TechNet Wiki so I thought it would be good to highlight a few of these.

Improving performance when executing a BRE rule:

Implement ordered messaging with BizTalk and SSIS:

BizTalk load testing in VS 2010:

Load testing for simultaneous BizTalk unit tests:

Install and configure BAM in a multi-server environment:


, , ,

Leave a comment

BizTalk MsBuild Generator Tips

A couple days ago I was working on creating some msbuild scripts for building my BizTalk solutions. I am not particularly knowledgeable about the way this is usually done. I checked out my friend (and fellow MVP) Michael Stephenson’s CodePlex project, the BizTalk MsBuild Generator at This tool is really helpful for getting something rapidly created that you can run with. There were a couple things I did to make this free tool work a little better and I wanted to share some of these tips so that others could get the most out of Michael’s great contribution to the BizTalk community.
I was working on some solutions in BizTalk 2009, SQL 2008, Windows Server 2008 R1/R2. I first started with some solutions that were building fine in VS 2008. There were a couple of minor things I had to get some of my projects to build properly. Some of these tips will seem very simple for someone with experience doing automated builds in TFS. But for someone with less experience, it can be confusing.
1. After going through the wizard to generate the msbuild files, the generator created a folder full of files so I tried to kick off the build with one of the .cmd files. It got errors part way through. Basically the build was having trouble finding my projects because my solution file was in a different place than it expected it to be. After a bit of inspection of the generated files, I opened up the generated .proj file. Here is what was initially under the Build target:
CallTarget Targets=CleanUp/>
CallTarget Targets=Setup/>
MSBuild Projects =$(SolutionName) Properties=Configuration=$(ConfigurationName);/>
CallTarget Targets=Deployment/>
CallTarget Targets=Publish/>
CallTarget Targets=ApplyBindings />
BizTalk.BuildGenerator.Tasks.StartApplication MessageBoxConnection=$(BizTalkManagementDatabaseConnectionString) ApplicationName=$(ProductName)/>
CallTarget Targets=UnitTests Condition=$(IncludeTests) />


I changed the MSBuild element’s project attribute by setting it to $(SourceCodeRootFolder)$(SolutionName) so that it could find the location of my projects. You could use a hard coded path here if the SourceCodeRootFolder value is not valid for your solution.
2. I rebuilded after making the change above and the build file works almost completely until it executes the last steps and fails. Some of the default assumptions of the generator are that you will want to deploy the BizTalk applications immediately and part of the same process which is common in continuous integration environments. In my environment I am not able to do this due to some deployment rules and constraints of how my BizTalk applications are being used.
I seemed to particularly have trouble with the following line:
<BizTalk.BuildGenerator.Tasks.StartApplication MessageBoxConnection =$(BizTalkManagementDatabaseConnectionString) ApplicationName=$(ProductName)/>


My troubles were because in my local development environment I do not always maintain bindings and binding configurations for some ports. You can comment this line out to avoid trying to start the BizTalk application.
3. I used the tool a couple times and did not have any problems generating the file. For one of my solutions I was not able to complete the wizard and I got the following error:
************** Exception Text **************
System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
at System.Reflection.Assembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at BizTalk.BuildGenerator.BizTalkHelper.AddResourceReferences(Resource resource, ApplicationResource applicationResource)
at BizTalk.BuildGenerator.BizTalkHelper.DescribeApplication(String applicationName)
at BizTalk.BuildGenerator.UI.UserControls.ApplicationDescriptionControl.GetDescription()
at BizTalk.BuildGenerator.UI.UserControls.ApplicationDescriptionControl.MoveNext()
at BizTalk.BuildGenerator.UI.WizardForm.ChooseApplicationPage_BeforeMoveNext(Object sender, CancelEventArgs e)
at Divelements.WizardFramework.WizardPageBase.OnBeforeMoveNext(CancelEventArgs e)
at Divelements.WizardFramework.Wizard.GoNext()
at Divelements.WizardFramework.Wizard.c(Object A_0, EventArgs A_1)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
This error occurs because one of the assemblies for a deployed BizTalk application cannot be found. This can happen if you have deployed your BizTalk application and then ungac an assembly by hand using gacutil /u or by deleting a file from c:Windowsassembly. For one of my solutions this was a problem. It can be notoriously hard to determine which assembly reference is the problem for large complicated solutions. This problem is repeatable – I tried a couple times.
I decided to dig into the problem a little deeper and downloaded the source for the generator from CodePlex. I was able to implement a quick workaround for the issue that resulted in being able to run the wizard successfully as well as generate a build file that built correctly. My patch for this issue can be found here: I also uploaded the patch to CodePlex and you can get it on the source codepatches link on the site. The patch includes both the assembly and the single source code file I updated.
If you just want the built file to fix your local installation of the BizTalk MsBuild generator, just copy the BizTalk.BuildGenerator assembly to your install folder and copy it to the GAC. If you want to build it from source, do the following. Take the BizTalkHelper.cs file from the patch and copy it over the same named file in the BizTalk.BuildGenerator project. The changes were just to wrap the body of the AddResourceReference method with a try/catch. I also added a line for logging the exception informatin.
These tips help you to be even more productive using the BizTalk MsBuild Generator tool. I was able to get quite a few solutions ready for MsBuild very quickly so I am glad Michael released this tool.

, ,