Vocabulary dependencies

Topics: Server Deployment
Feb 9, 2016 at 11:20 AM
Trying to create a BTDF where two vocabulary files exists, a Constants and a Vocabulary file. The Vocabulary file depends on the Constants file.
The project file defines the following:
  <ItemGroup>
    <RuleVocabularies Include="Constants.xml">
      <LocationPath>..\Rules</LocationPath>
    </RuleVocabularies>
    <RuleVocabularies Include="Vocabulary.xml">
      <LocationPath>..\Rules</LocationPath>
    </RuleVocabularies>
  </ItemGroup>
The deployment is successful but undeployment fails because the two vocabulary files are undeployed in the same order as listed above. Trying to remove Constants without removing Vocabulary first is a no-go.

Is there a way to tell BTDF to undeploy files listed in an ItemGroup in reverse order?

Using BTDF 6 for BizTalk 2013 R2.

Thanks
Claus
Mar 9, 2016 at 2:05 PM
Hmm, looking over the code in bzitalkDeploymentFramework.targets and BizTalkDeploymentFramework.Tasks.dll (the PopulateRulePoliciesMetadata method) it appears that it actually reverses the list before undeploying the vocabularies.

I'll have another look why it fails in my setup.
Coordinator
Mar 11, 2016 at 6:16 AM
Yes, it explicitly reverses the order, so I'm curious to hear your findings.

Thanks,
Tom
Mar 11, 2016 at 7:30 AM
It still fails and I'm not sure why.

This is the configuration related to vocabularies:
  <!-- RULE VOCABULARIES-->
  <ItemGroup>
    <RuleVocabularies Include="Constants.xml">
      <LocationPath>..\Rules</LocationPath>
    </RuleVocabularies>
    <RuleVocabularies Include="Vocabulary.xml">
      <LocationPath>..\Rules</LocationPath>
    </RuleVocabularies>
  </ItemGroup>
This is an extract from the deploy log in chronological order:
Target "_UndeployVocabAndRules" in file "C:\Program Files (x86)\myproject.shared\1.6.0\Deployment\Framework\BizTalkDeploymentFramework.targets" from project "C:\Program Files (x86)\myproject.shared\1.6.0\Deployment\Deployment.btdfproj" (target "DevUndeploy" depends on it):
Using "PopulateRulePoliciesMetadata" task from assembly "C:\Program Files (x86)\myproject.shared\1.6.0\Deployment\Framework\BizTalkDeploymentFramework.Tasks.dll".

Task "PopulateRulePoliciesMetadata"
  Populating metadata in ItemGroup from policy/vocabulary files content...
    Working on '..\BRE\Vocabularies\Constants.xml'...
      Added item [PolicyName:'Constants'; PolicyVersion:'2.0']
      Added item [PolicyName:'Constants'; PolicyVersion:'2.1']
      Added item [PolicyName:'Constants'; PolicyVersion:'2.2']
  Finished populating metadata in ItemGroup from policy/vocabulary files content.
Done executing task "PopulateRulePoliciesMetadata".

Task "PopulateRulePoliciesMetadata"
  Populating metadata in ItemGroup from policy/vocabulary files content...
    Working on '..\BRE\Vocabularies\Vocabulary.xml'...
      Added item [PolicyName:'Vocabulary'; PolicyVersion:'1.5']
  Finished populating metadata in ItemGroup from policy/vocabulary files content.
Done executing task "PopulateRulePoliciesMetadata".

Task "Exec"
  "C:\Program Files (x86)\myproject.shared\1.6.0\Deployment\Framework\DeployTools\DeployBTRules.exe" /vocabularyName "Constants" /ruleSetVersion "2.0" /unpublish /undeploy
  BizTalk Rules Engine Policy/Vocabulary Deployment Tool v6.0.110.0
  Copyright (C) 2008-14 Thomas F. Abraham, 2004-08 Scott Colestock
  
  Unpublishing vocabulary 'Constants' version 2.0...
  Failed: Microsoft.RuleEngine.RuleStoreVocabularyInUseException: Unable to delete vocabulary "Constants", version 2.0 as it is used by other rulesets and/or vocabularies.
     at Microsoft.RuleEngine.SqlRuleStore.RemoveFromDB(SqlConnection connection, VocabularyInfo vocabulary, SqlTransaction tx)
     at Microsoft.RuleEngine.SqlRuleStore.Remove(VocabularyInfo vocabulary)
     at DeployBTRules.DeployRules.ProcessVocabularies(DeployRulesCommandLine cl, RuleSetDeploymentDriver dd)
     at DeployBTRules.DeployRules.Main(String[] args)

C:\Program Files (x86)\myproject.shared\1.6.0\Deployment\Framework\BizTalkDeploymentFramework.targets(1585,5): error MSB3073: The command ""C:\Program Files (x86)\myproject.shared\1.6.0\Deployment\Framework\DeployTools\DeployBTRules.exe" /vocabularyName "Constants" /ruleSetVersion "2.0" /unpublish /undeploy" exited with code -1. [C:\Program Files (x86)\myproject.shared\1.6.0\Deployment\Deployment.btdfproj]
Done executing task "Exec" -- FAILED.
Done building target "_UndeployVocabAndRules" in project "Deployment.btdfproj" -- FAILED.
Done Building Project "C:\Program Files (x86)\myproject.shared\1.6.0\Deployment\Deployment.btdfproj" (UndeployBizTalkMgmtDB_true target(s)) -- FAILED.
As you can see it does not seem like it reverses the list.

Thanks
Claus