Sometimes errors seem to find me, sometimes it fills that I’m chasing errors! And because someone did something that you shouldn’t do, configuring the build folder of a Functoid project to be <BizTalk Server installation folder>\Developer Tools\Mapper Extensions directory, I got a new and strange error while trying to open a BizTalk map inside Visual Studio: Microsoft BizTalk Mapper Unable to load wrapper. Here is the full error message:
Microsoft BizTalk Mapper
Unable to load wrapper <BizTalk Server installation folder>\Developer Tools\Mapper Extensions\Microsoft.BizTalk.Interop.Agent.dll
Of course, at that time I was quite curious to know the cause of this problem because I didn’t do anything wrong, just building a custom Functoid project and a few minutes before I actually was working on a map and I was able to open without any kind of problems.
When you build a project, by default any kind of project it will add the project assemblies as well as the dependencies to the bin\Debug\ – again this is the default behavior.
In this case, by changing this behavior in a Custom Functoid project to the <BizTalk Server installation folder>\Developer Tools\Mapper Extensions directory, was causing the problem, because it was adding not only the custom Functoid assembly but also some BizTalk internal assemblies, in this case the Microsoft.BizTalk.Interop.Agent.dll, that are incompatible with the internal BizTalk Mapper wrapper.
Note: BizTalk Server installation folder>\Developer Tools\Mapper Extensions directory is where Visual Studio BizTalk project looks for custom functoids to be added to the Toolbox.
Once again, the solution is simple, you should delete all the unnecessary assemblies, especially the internal ones of the product.
Once you delete all the unnecessary assemblies, in this case, the Microsoft.BizTalk.Interop.Agent.dll, and I also advise to delete all the ones that are selected on the above picture, the Unable to load wrapper problem will be solved and you can once again open the BizTalk Mapper without any kind of problems inside Visual Studio