Undeploying a BizTalk Application Programmatically

Topics: General Questions, Server Deployment, Tips and Tricks
Jun 6, 2013 at 8:50 PM
I know there is a way with btstask to undeploy and application, is there a way I could do this in the inital steps of the installer? I saw references to a setting called <SkipRemoveApp> which I set to false but that didn't seem to do anything. Instead of having to manually undeploy, is there anyway to undeploy the app automatically (on the server install that seleclted the "Last" check box)?

Thanks,
Craig
Coordinator
Jun 10, 2013 at 8:06 AM
Hi Craig,

The fact that the deployment process involves so many artifacts and moving parts makes it hard for a new version of an app to properly undeploy an old version. That's why the requirement exists to undeploy the existing app before upgrading the MSI -- so that the same script that deployed also undeploys. It's really easy to delete a BizTalk app, but there are so many more things to be cleaned up that go beyond the delete (which btstask and BizTalk Admin do not do).

However, you can completely script all deploys and undeploys if you so desire. The most common way is with PowerShell, and you'll find other threads here about that.

Thanks,
Tom
Jun 12, 2013 at 7:48 PM
Hey Tom - thanks for the reply. Yeah understood on the complexities, I follow that. I'm just trying to automate a few things so I don't need a full undeploy, just enough for me to be able to push out new stuff. I narrowed it down to these 2 commands which work great when the app is stopped/unenlisted, but can I also do that step programmatically somehow? Appreciate it.

Here's what I have, just need a pre-step to stop the app:
BTSTask RemoveApp /ApplicationName:C3Integration
BTSTask UninstallApp /ApplicationName:C3Integration

Thanks,
Craig
Coordinator
Jun 13, 2013 at 6:04 AM
Hi Craig,

Based on what you are trying to do, you should just create a new Target within your .btdfproj and script your mini-process inside of it with MSBuild tasks. You can call any existing Deployment Framework task. Look at C:\Program Files [(x86]\MSBuild\DeploymentFrameworkForBizTalk\5.0\BizTalkDeploymentFramework.targets to see how all of the existing processes are structured.

You can try this. I'm just making it up as I go so it might not work without some debugging:
  <PropertyGroup>
    <UndeployAppDependsOn>
      Bootstrap;
      GetSoftwarePaths;
      InitializeAppName;
      PrepareAppForUndeploy;
      UndeployAppDefinition;
    </UndeployAppDependsOn>
  </PropertyGroup>

  <Target Name="UndeployApp" DependsOnTargets="$(UndeployAppDependsOn)" />
Then run <msbuildpath>\MSBuild.exe /t:UndeployApp Deployment.btdfproj

Thanks,
Tom
Jun 13, 2013 at 2:38 PM
Very nice - thanks Tom.

Craig