Dear all,
We are using BizTalk 2010 in our organisation and building several solution on a TFS2008 buildserver. On the build server we have installed the following items:
- Visual Studio 2010 (for running tests and building web installation MSI's).
- BizTalk 2010 (all options disabled, only 'Project buildcomponent').
- MSBuild extensions
When building biztalk solutions everything works as it should but last week a bug came up in on of our solutions. I tracked it down to a Flat File that was not correctly parsed on the production server. First we thought it had to do with regional setting and/or code pages (which we encountered in the past) but it did not have anything to do with these kind of settings.
It turned out that code that was build on our developer workstations worked fine, but code that was build on our build server did not. During compile the XSD's in a BizTalk project are converted to C#-classes. It turns out that there are slight differences between the generated code on the developer PC's versus the code generated on the build servers.
Build server version:
namespace Schemas {using Microsoft.XLANGs.BaseTypes; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.BizTalk.Schema.Compiler", "3.0.1.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [SchemaType(SchemaTypeEnum.Document)] [Schema(@"http://Schemas.FlatFileSchema1",@"Root")] [System.SerializableAttribute()] [SchemaRoots(newstring[] {@"Root"})]publicsealedclass FFRequest : Microsoft.XLANGs.BaseTypes.SchemaBase { [System.NonSerializedAttribute()]privatestaticobject _rawSchema; [System.NonSerializedAttribute()]privateconststring _strSchema = @"<?xml version=""1.0"" encoding=""utf-16""?><xs:schema xmlns=""http://Schemas.FlatFileSchema1"" xmlns:b=""http://schemas.microsoft.com/BizTalk/2003"" targetNamespace=""http://Schemas.FlatFileSchema1"" xmlns:xs=""http://www.w3.org/2001/XMLSchema""><xs:annotation><xs:appinfo><schemaEditorExtension:schemaInfo namespaceAlias=""b"" extensionClass=""Microsoft.BizTalk.FlatFileExtension.FlatFileExtension"" standardName=""Flat File"" xmlns:schemaEditorExtension=""http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions"" /><b:schemaInfo standard=""Flat File"" codepage=""1252"" default_pad_char="" "" pad_char_type=""char"" count_positions_by_byte=""false"" parser_optimization=""speed"" lookahead_depth=""3"" suppress_empty_nodes=""false"" generate_empty_nodes=""true"" allow_early_termination=""false"" early_terminate_optional_fields=""false"" allow_message_breakup_of_infix_root=""false"" compile_parse_tables=""false"" root_reference=""Root"" culture=""invariant"" xmlns:b=""http://schemas.microsoft.com/BizTalk/2003"" /></xs:appinfo></xs:annotation><xs:element name=""Root""><xs:annotation><xs:appinfo><b:recordInfo structure=""delimited"" child_delimiter_type=""hex"" child_delimiter=""0x3B 0x0D 0x0A"" child_order=""postfix"" preserve_delimiter_for_empty_data=""true"" suppress_trailing_delimiters=""false"" /></xs:appinfo></xs:annotation><xs:complexType><xs:sequence><xs:annotation><xs:appinfo><groupInfo xmlns=""http://schemas.microsoft.com/BizTalk/2003"" /></xs:appinfo></xs:annotation><xs:element maxOccurs=""unbounded"" name=""Request""><xs:annotation><xs:appinfo><b:recordInfo structure=""delimited"" child_delimiter_type=""hex"" child_delimiter=""0xD 0xA"" child_order=""postfix"" preserve_delimiter_for_empty_data=""true"" suppress_trailing_delimiters=""false"" /></xs:appinfo></xs:annotation><xs:complexType><xs:attribute name=""Lable"" type=""xs:string""><xs:annotation><xs:appinfo><b:fieldInfo justification=""left"" /></xs:appinfo></xs:annotation></xs:attribute><xs:attribute name=""Number"" type=""xs:string""><br/> <xs:annotation><xs:appinfo><b:fieldInfo justification=""left"" /></xs:appinfo></xs:annotation></xs:attribute></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element></xs:schema>";public FFRequest() { }publicoverridestring XmlContent {get {return _strSchema; } }publicoverridestring[] RootNodes {get {string[] _RootElements = newstring [1]; _RootElements[0] = "Root";return _RootElements; } }protectedoverrideobject RawSchema {get {return _rawSchema; }set { _rawSchema = value; } } } }
Developer PC version:
namespace Schemas {using Microsoft.XLANGs.BaseTypes; [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.BizTalk.Schema.Compiler", "3.0.1.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [SchemaType(SchemaTypeEnum.Document)] [Schema(@"http://Schemas.FlatFileSchema1",@"Root")] [System.SerializableAttribute()] [SchemaRoots(newstring[] {@"Root"})]publicsealedclass FFRequest : Microsoft.XLANGs.BaseTypes.SchemaBase { [System.NonSerializedAttribute()]privatestaticobject _rawSchema; [System.NonSerializedAttribute()]privateconststring _strSchema = @"<?xml version=""1.0"" encoding=""utf-16""?><xs:schema xmlns=""http://Schemas.FlatFileSchema1"" xmlns:b=""http://schemas.microsoft.com/BizTalk/2003"" targetNamespace=""http://Schemas.FlatFileSchema1"" xmlns:xs=""http://www.w3.org/2001/XMLSchema""><xs:annotation><xs:appinfo><schemaEditorExtension:schemaInfo namespaceAlias=""b"" extensionClass=""Microsoft.BizTalk.FlatFileExtension.FlatFileExtension"" standardName=""Flat File"" xmlns:schemaEditorExtension=""http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions"" /><b:schemaInfo standard=""Flat File"" codepage=""1252"" default_pad_char="" "" pad_char_type=""char"" count_positions_by_byte=""false"" parser_optimization=""speed"" lookahead_depth=""3"" suppress_empty_nodes=""false"" generate_empty_nodes=""true"" allow_early_termination=""false"" early_terminate_optional_fields=""false"" allow_message_breakup_of_infix_root=""false"" compile_parse_tables=""false"" root_reference=""Root"" culture=""invariant"" xmlns:b=""http://schemas.microsoft.com/BizTalk/2003"" /></xs:appinfo></xs:annotation><xs:element name=""Root""><xs:annotation><xs:appinfo><b:recordInfo structure=""delimited"" child_delimiter_type=""hex"" child_delimiter=""0x3B 0x0D 0x0A"" child_order=""postfix"" preserve_delimiter_for_empty_data=""true"" suppress_trailing_delimiters=""false"" /></xs:appinfo></xs:annotation><xs:complexType><xs:sequence><xs:annotation><xs:appinfo><groupInfo xmlns=""http://schemas.microsoft.com/BizTalk/2003"" /></xs:appinfo></xs:annotation><xs:element maxOccurs=""unbounded"" name=""Request""><xs:annotation><xs:appinfo><b:recordInfo structure=""delimited"" child_delimiter_type=""hex"" child_delimiter=""0xD 0xA"" child_order=""postfix"" preserve_delimiter_for_empty_data=""true"" suppress_trailing_delimiters=""false"" /></xs:appinfo></xs:annotation><xs:complexType><xs:attribute name=""Lable"" type=""xs:string""><xs:annotation><xs:appinfo><b:fieldInfo justification=""left"" sequence_number=""1"" /></xs:appinfo></xs:annotation></xs:attribute><xs:attribute name=""Number"" type=""xs:string""><br/> <xs:annotation><xs:appinfo><b:fieldInfo justification=""left"" sequence_number=""2"" /></xs:appinfo></xs:annotation></xs:attribute></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element></xs:schema>";public FFRequest() { }publicoverridestring XmlContent {get {return _strSchema; } }publicoverridestring[] RootNodes {get {string[] _RootElements = newstring [1]; _RootElements[0] = "Root";return _RootElements; } }protectedoverrideobject RawSchema {get {return _rawSchema; }set { _rawSchema = value; } } } }
After carefull examination you will notice that there is a difference in the line:
<b:fieldInfo justification=""left"" sequence_number=""1"" />
On the build server version the part sequence_number=""1"" is absent. This of course results in some unwanted runtime behavior. I've noticed the same differences when applying a Date formatting mask on a date field. On thebuild server this mask is absent resulting in the default parsing of a date (which in our case failed because we use a dutch formatted date).
I wonder if this behavior is intended or that this is a bug?
The quick fix (or work around) is to install some extra components on the buildserver:
- BizTalk 2010 (added 'Enterprise SSO Administration' and 'Developer tools and SDK').
After this the generated code from the build server looks exactly like the code from my developer workstation. But my assumption was that the extra's I installed weren't needed for building BizTalk projects.