0
votes

This is a question to gather possible causes of the compile error "Schema reference [assembly].[type] is not a valid reference or does not exist in the current project".

In a BizTalk solution, I have a common schemas assembly with a KiTH MsgHead schema that I have to reference as an import in another schema in another project. This is perfectly possible, even though search results on the web made me believe it might not.

An import statement like this is correct, without a doubt:

<xs:import namespace="http://www.kith.no/xmlstds/msghead/2006-05-24" schemaLocation="HP.BizTalk.KiTH.Schema.MsgHead_v12.MsgHead_v1_2"/>

Here the schema has type name MsgHead_v1_2 and exists in an assembly HP.BizTalk.KiTH.Schema.MsgHead_v12. When building the solution, I get the following compile error:

Screenshot of the compile error

I will answer my own question with the solution that I couldn't find in any of the search results on the web.

1
There are blogs about it. geekswithblogs.net/LeonidGaneline/archive/2013/07/19/… and biztalkrelated.blogspot.com/2012/06/… But they got a different errors, hence you not finding them - Dijkgraaf

1 Answers

1
votes

When I created the common schemas project, I imported it from another repository and had to change project name, namespaces etc. Also the AssemblyInfo.cs file was recreated because of issues related to renaming.

If the assembly attribute BizTalkAssembly is missing, the compiler doesn't complain at all. But since it's no longer a BizTalk assembly, it leads to issues that can be very confusing and impossible to understand. I couldn't use the schema from the common assembly in a BizTalk Map, and I couldn't import it into another schema, as the question says. So by adding in the following line to AssemblyInfo.cs, the misleading compile error disappeared:

[assembly: Microsoft.XLANGs.BaseTypes.BizTalkAssembly(typeof(Microsoft.BizTalk.XLANGs.BTXEngine.BTXService))]

enter image description here