Table of Contents


When multiple root nodes exist in a single schema BizTalk Server creates a message type for each root node. Many times we need to use the "Generate Instance" feature of the BizTalk Server SDK in Visual Studio to create sample data for each message type. 

This presents a problem, as when selecting the "Generate Instance" feature from Solution Explorer, only an instance of the first root node will be created.


This article was prepared considering a freshly built development machine running Windows 10, with Visual Studio 2015 and BizTalk Server SDK installed.


To generate instances of the remaining root nodes, create a copy of the schema file and, on the copy file, move each root node up to the top of the schema, generating the instances for each node one at a time. This copy schema will have to be deleted after the instances are generated. 

A step by step description follows:

  1. Create a copy of the schema. To make it easy to remember to delete the copy file, simply highlight the file in Solution Explorer and hit Ctrl-C and Ctrl-V. A file with " - Copy" appended to the original file name will be created.
  2. Generate an instance for the first node by selecting the "Generate Instance" feature from the schema file context menu in Solution Explorer. 
  3. Once an instance is generated Visual Studio will show the filename on the Output window. Highlight the name of the generated instance file from the drive letter forward, leaving out the "file//" prefix. Copy to the clipboard using Ctrl-C.

  4. Right-click the Project in solution explorer and select Add, Existing Item. Paste the file name using Ctrl-V and click Add. The file will be added to the solution.
  5. Rename the instance file to reflect the name of the schema and the root node it represents.
  6. To generate instances for the other root nodes , move each Root node to the top of the schema. Double-click the copy file in Solution Explorer. The BizTalk Schema Editor will open showing the multiple root nodes.
  7. Drag each root node to the top of the schema. Only drop the node once you see the mouse icon with an arrow pointing straight up. 
  8. Once the root is moved to the top of the schema, save the file with Ctrl-S and select the "Generate Instance" feature from the schema file context menu in Solution Explorer. 
  9. Go back to step 3 above. Do this for every root node instance you need from the schema.
  10. Remember to delete the copy file once you are done.