NAnt.Tasks can't find RemoveReceivePort method in ExplorerOM

Apr 1, 2010 at 3:35 PM

Hello,

I come from a background of using MSBuild for BizTalk 2006 deployments and it has always worked for me well. We now have a requirement where one of our clients is using BizTalk 2004 and it got me to start using BTDF with NAnt which seems an equally powerful deployment framework.

I am using BTDF v4.0 since it is the latest version that supports BizTalk 2004 deployments; however, after it has deployed the BizTalk assemblies it fails showing the following error:

[controlbiztalkports] controlbiztalkports:
[controlbiztalkports]
[controlbiztalkports] Enabling/Starting...
[controlbiztalkports]
[controlbiztalkports] (Discarding changes to the catalog)...
[controlbiztalkports]
[controlbiztalkports] System.MissingMethodException: Method not found: 'Void Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer.RemoveReceivePort(Microsoft.BizTalk.ExplorerOM.IReceivePort)'.
[controlbiztalkports]    at BizTalk.NAnt.Tasks.ControlBizTalkPorts.DoReceivePorts(XPathNavigator nav)
[controlbiztalkports]    at BizTalk.NAnt.Tasks.ControlBizTalkPorts.ExecuteTask()

BUILD FAILED

C:\Deployment\BizTalkDeploymentInclude.nant(1124,11):
Failed to control ports.
    Method not found: 'Void Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer.RemoveReceivePort(Microsoft.BizTalk.ExplorerOM.IReceivePort)'.

I have tried all previous versions of BTDF but they all end up with the same error. I verified that Microsoft.BizTalk.ExplorerOM has got a public BtsCatalogExplorer.RemoveReceivePort(IReceivePort) method and that it is deployed in BizTalk’s ‘Developers Tools’ folder and in GAC as well. I also verified that it is the correct version of dll that BizTalk.NAnt.Tasks is looking for.

I am sure I am missing something here but can’t think of what could it be; any help will be greatly appreciated.

Many Thanks,
Jay

Coordinator
Apr 1, 2010 at 3:47 PM

Hi Jay,

If you don't have it already, please download 4.0's DFBT2006ToolsSource_V40.zip.  There you'll find BizTalk.NAnt.Tasks_net2.0, the source code for the custom NAnt tasks DLL that includes the ControlBizTalkPorts task referenced above.

I suggest that you rebuild that solution against your BizTalk 2004 DLL's, then replace your existing BizTalk.NAnt.Tasks.dll with the newly compiled version and give it another shot.  Perhaps the custom tasks DLL was compiled against a slightly different (like no service pack) version of the BizTalk DLL's.

Please give that a try and let me know what happens.

Thanks,
Tom

Apr 1, 2010 at 5:02 PM

Thanks for your prompt reply Tom,

Yes I started going down that route initially, but since BizTalk 2004 does not come with Microsoft.BizTalk.Operations and NAnt tasks DLL references it, I couldn’t get the project to compile successfully. Also if that was the case, don't you think it may have thrown some other error like assembly not found etc.

By looking at the code I can see it can initialize BtsCatalogExplorer, access its member ReceivePorts successfully indicating it is able to load the assembly; but starts complaining when it gets to the point where it calls the RemoveReceivePort method.

I might be barking up the wrong tree here so just to get it compiled, I have now copied Microsoft.BizTalk.Operations from another machine with BizTalk 2006 on it and now BizTalk.NAnt.Tasks is not able to find the ‘Application’ class in ExplorerOM and is failing again on compile time which indicates that it was built with the ExplorerOM DLL from BizTalk 2006.

I can’t copy ExplorerOM from BizTalk 2006 as well as it’ll kill the purpose for this exercise - do you suggest I change the code to remove any references to the Application class and see what it does or should we try going some other route?

Thanks again for your time and concerns Tom...

Regards,
Jay

Coordinator
Apr 1, 2010 at 5:52 PM

Since you are on BT2004, you can delete the tasks AddAppReference, ControlBizTalkApp, CheckForServiceInstances and TerminateServiceInstances which are all for BT2006+, to eliminate the dependency on the Microsoft.BizTalk.Operations DLL.  Hopefully that will let you compile successfully.  BT2004's BtsCatalogExplorer DOES have the RemoveReceivePort() method:

http://msdn.microsoft.com/en-us/library/ee277966(v=BTS.10).aspx

It would be interesting to copy your Microsoft.BizTalk.ExplorerOM.dll out of the GAC folder and open it with .NET Reflector to verify that the BtsCatalogExplorer.RemoveReceivePort() method does indeed exist.  It still feels like a side effect of the tasks DLL being built against the 2006 version of Microsoft.BizTalk.ExplorerOM.dll, which I know it was.

Also please double-check that in your .deploy.build file you do not have the biztalk2006 property set to true.

Thanks,
Tom

Apr 6, 2010 at 11:19 AM
Edited Apr 6, 2010 at 11:34 AM

Hi Tom,

Sorry for the delayed reply due to Easter holidays; removing BT2006 tasks as mentioned in your message above and recompiling BizTalk.NAnt.Tasks while referencing to Microsoft.BizTalk.ExplorerOM from BT2004 solved the problem.

Thanks for all the help again...

Cheers,
Jay