Wednesday, August 11, 2010

Having problems undeploying that pesky BizTalk Assembly?


Have you ever received the following error message when trying to undeploy a BizTalk assembly?
"Some items in the removed assembly are still being used by items not defined in the same assembly, thus removal of the assembly failed."
Make sure that items in the assembly you are trying to remove fulfill the following conditions:
1. Pipelines, maps, and schemas are not being used by Send Ports or Receive Locations
2. Roles have no enlisted parties.
Here's a query used against the mgmt database for those of you on BizTalk 2004/2006 for finding the maps and pipelines that are still deployed that might be getting in your way of undeploying:

select 'RcvPort' PortType, r.nvcName Port, item.name MapName,assem.nvcName Assembly, indoc_docspec_name, outdoc_docspec_name from bts_receiveport_transform rt join bts_receiveport r on rt.nReceivePortID = r.nID join bt_mapspec ms on ms.id = rt.uidTransformGUID join bts_assembly assem on ms.assemblyid = assem.nID join bts_item item on ms.itemid = item.id union select 'SendPort' PortType, r.nvcName Port, item.name MapName, assem.nvcName Assembly, indoc_docspec_name, outdoc_docspec_name from bts_sendport_transform rt join bts_sendport r on rt.nSendPortID = r.nID join bt_mapspec ms on ms.id = rt.uidTransformGUID join bts_assembly assem on ms.assemblyid = assem.nID join bts_item item on ms.itemid = item.id order by Assembly, PortType, Port select 'SendPort' Type, ReceivePortName = '', bts_sendport.nvcName [SendPort/ReceiveLocation], bts_pipeline.[name]PipelineName from bts_sendport join bts_pipeline on bts_sendport.nSendPipelineID = bts_pipeline.[ID] where bts_pipeline.[name]<> 'Microsoft.BizTalk.DefaultPipelines.XMLTransmit' AND bts_pipeline.[name]<> 'Microsoft.BizTalk.DefaultPipelines.PassThruTransmit' union select 'ReceiveLocation' Type, bts_receiveport.nvcName ReceivePortName, adm_receiveLocation.[Name] [SendPort/ReceiveLocation], bts_pipeline.[name]PipelineName from adm_ReceiveLocation join bts_pipeline on adm_receiveLocation.ReceivePipelineID = bts_pipeline.[ID] join bts_receiveport on adm_receivelocation.receiveportid = bts_receiveport.nID where bts_pipeline.[name]<> 'Microsoft.BizTalk.DefaultPipelines.XMLReceive' AND bts_pipeline.[name]<> 'Microsoft.BizTalk.DefaultPipelines.PassThruReceive' order by Type, PipelineName