<?xml version="1.0" encoding="utf-8" ?>
<!-- 
  Deployment Framework for BizTalk
  Copyright (C) Thomas F. Abraham, Scott Colestock
  C:\Program Files (x86)\Deployment Framework for BizTalk 5.7\Developer\ProjectTemplate
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Installer">
	<PropertyGroup>
		<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
		<Platform Condition="'$(Platform)' == ''">x86</Platform>
		<!--Customization Generic Apps-->
		<IsGenericComponent>False</IsGenericComponent>
		<IntegrationCode>F017</IntegrationCode>
		<UseEnvSettingsDB>True</UseEnvSettingsDB>
		<!-- Customization SSO Data Store Credentials -->
		<SsoAppAdminGroup>$(SsoAppAdmin2016)</SsoAppAdminGroup>
		<SsoAppUserGroup>$(SsoAppAdmin2016)</SsoAppUserGroup>
		<!--End Customization-->
		<SchemaVersion>1.0</SchemaVersion>
		<ProjectVersion>1.0</ProjectVersion>
		<ProjectName>KLG.Extern</ProjectName>
		<IncludeComponents>True</IncludeComponents>
		<IncludePipelineComponents>False</IncludePipelineComponents>
		<IncludePipelines>False</IncludePipelines>
		<IncludeOrchestrations>True</IncludeOrchestrations>
		<IncludeSchemas>True</IncludeSchemas>
		<IncludeTransforms>True</IncludeTransforms>
		<IncludeMessagingBindings>True</IncludeMessagingBindings>
		<UsingMasterBindings>True</UsingMasterBindings>
		<RequireXmlPreprocessDirectives>False</RequireXmlPreprocessDirectives>
		<ApplyXmlEscape>True</ApplyXmlEscape>
		<IncludeSettingsSpreadsheetInMsi>False</IncludeSettingsSpreadsheetInMsi>
		<SkipIISReset>True</SkipIISReset>
		<EnableAllReceiveLocationsOnDeploy>False</EnableAllReceiveLocationsOnDeploy>
		<IncludeSSO>True</IncludeSSO>
		<SkipHostInstancesRestart>True</SkipHostInstancesRestart>
	</PropertyGroup>
	<PropertyGroup>
		<!-- Properties related to building an MSI for server deployments -->
		<!-- BizTalk App Version Upgrade -->
		<!--   For each new product release to be deployed to your BizTalk servers: -->
		<!--     1) Increment ProductVersion -->
		<!--     2) Generate a new GUID and update ProductId with the new GUID -->
		<!--   This allows the new MSI to automatically uninstall (not undeploy!) the old MSI and install the new one. -->
		<ProductVersion>3.0.43</ProductVersion>
		<PackageRevisionLog>Migratie 2016</PackageRevisionLog>
		<ProductId>8ff228dd-667e-4189-a9bf-f5ec4426258c</ProductId>
		<ProductName>TM.Bosman</ProductName>
		<ProductUpgradeCode>8180e568-5f30-455f-a294-23f08f315d61</ProductUpgradeCode>
		<Manufacturer>KLG EDI Team</Manufacturer>
		<PackageDescription>$(ProductName)</PackageDescription>
		<PackageComments>$(ProductName)</PackageComments>
		<BizTalkAppDescription>Last Deployment: $(ProductName)-$(ProductVersion) on: $([System.DateTime]::Now) By: $(USERNAME)</BizTalkAppDescription>
	</PropertyGroup>
	<!-- Under TFS Team Build, set CustomizableOutDir property to true in TFS 2005/2008/2010 UpgradeTemplate. -->
	<!-- With a workflow build, copy the default template then modify the MSBuild task for the solution build. Set OutDir to blank and -->
	<!-- CommandLineArguments to String.Format("/p:SkipInvalidConfigurations=true;TeamBuildOutDir=""{0}"" {1}", BinariesDirectory, MSBuildArguments). -->
	<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
		<DeploymentFrameworkTargetsPath>$(MSBuildExtensionsPath)\DeploymentFrameworkForBizTalk\5.0\</DeploymentFrameworkTargetsPath>
		<OutputPath Condition="'$(TeamBuildOutDir)' == ''">bin\Debug\</OutputPath>
		<OutputPath Condition="'$(TeamBuildOutDir)' != ''">$(TeamBuildOutDir)</OutputPath>
		<DeployPDBsToGac>false</DeployPDBsToGac>
	</PropertyGroup>
	<PropertyGroup Condition="'$(Configuration)' == 'Release'">
		<DeploymentFrameworkTargetsPath>$(MSBuildExtensionsPath)\DeploymentFrameworkForBizTalk\5.0\</DeploymentFrameworkTargetsPath>
		<OutputPath Condition="'$(TeamBuildOutDir)' == ''">bin\Release\</OutputPath>
		<OutputPath Condition="'$(TeamBuildOutDir)' != ''">$(TeamBuildOutDir)</OutputPath>
		<DeployPDBsToGac>false</DeployPDBsToGac>
	</PropertyGroup>
	<PropertyGroup Condition="'$(Configuration)' == 'Server'">
		<DeploymentFrameworkTargetsPath>Framework\</DeploymentFrameworkTargetsPath>
		<!-- Get our PDBs into the GAC so we get file/line number information in stack traces. -->
		<DeployPDBsToGac>true</DeployPDBsToGac>
	</PropertyGroup>
	<ItemGroup>
		<PropsFromEnvSettings Include="SsoAppUserGroup;SsoAppAdminGroup;ESBLookupConnectionString2016;ESBTrackingConnectionString;B2BUsername;B2BPassword"/>
		<AppsToReference Include="KLG.Intern"/>
	</ItemGroup>
	<Import Project="$(DeploymentFrameworkTargetsPath)BizTalkDeploymentFramework.targets"/>
	<!-- ============ START Deployment OVERRIDE ============ -->
	<Import Project="$(BTDFEXTENSIONPATH)\Targets\1.0.0\Custom.BizTalkDeploymentFramework.targets"/>
	<Import Project="$(DeploymentFrameworkTargetsPath)BizTalkDeploymentFramework.Redeploy.targets"/>
	<!--
    The Deployment Framework automatically packages most files into the server install MSI.
    However, if there are special folders that you need to include in the MSI, you can
    copy them to the folder $(RedistDir) in the CustomRedist target.
    To include individual files, add an ItemGroup with AdditionalFiles elements.
  -->
	<Target Name="UndeployAppDefinition" Condition="'$(SkipUndeploy)' == 'false'" DependsOnTargets="PrepareAppForUndeploy">
		<Message Text="-&gt; Override UndeployAppDefinition (no application removal is done!)"/>
		<Exec Command="BTSTask.exe RemoveResource -ApplicationName:&quot;$(BizTalkAppName)&quot; -Luid:&quot;$(ProductName).Orchestrations, Version=3.0.3.0, Culture=neutral, PublicKeyToken=$(ProductPublicKey)&quot;" Condition="'$(AppExists)' == 'true'" ContinueOnError="true" />
		<Exec Command="BTSTask.exe RemoveResource -ApplicationName:&quot;$(BizTalkAppName)&quot; -Luid:&quot;$(ProductName).Transforms, Version=3.0.31.0, Culture=neutral, PublicKeyToken=$(ProductPublicKey)&quot;" Condition="'$(AppExists)' == 'true'" ContinueOnError="true"/>
		<Exec Command="BTSTask.exe RemoveResource -ApplicationName:&quot;$(BizTalkAppName)&quot; -Luid:&quot;$(ProductName).Schemas, Version=3.0.1.0, Culture=neutral, PublicKeyToken=$(ProductPublicKey)&quot;" Condition="'$(AppExists)' == 'true'" ContinueOnError="true"/>
		<Exec Command="BTSTask.exe RemoveResource -ApplicationName:&quot;$(BizTalkAppName)&quot; -Luid:&quot;$(ProductName).Components, Version=3.0.0.0, Culture=neutral, PublicKeyToken=$(ProductPublicKey)&quot;" Condition="'$(AppExists)' == 'true'" ContinueOnError="true"/>
	</Target>
	<Target Name="StopApplication" DependsOnTargets="VerifyBizTalkAppExists">
		<Message Text="-&gt; Override StopApplication"/>
		<!--Stop Orchestrations-->
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Stop" SendPortName="" ReceivePortName="" OrchestrationName="TM.Bosman.Orchestrations.TM_Bosman_Orchestrations_IFCSUM" Condition="'$(AppExists)' == 'true'"/>
		<!--Stop Send Ports (optional remove mapping)-->
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Stop" SendPortName="TM.Bosman.Orchestrations_3.0.3.0_TM.Bosman.Orchestrations.TM_Bosman_Orchestrations_IFCSUM_Mail_Send_ef8f53020aeb0dca" ReceivePortName="" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Stop" SendPortName="TM.Bosman: TM.Shared.OrderStatus_to_TM.Bosman.IFTSTA" ReceivePortName="" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Stop" SendPortName="TM.Bosman: TM.Bosman.Reference.Administration" ReceivePortName="" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Stop" SendPortName="TM.Bosman: Orchestration_TM.Shared.Order" ReceivePortName="" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Stop" SendPortName="TM.Bosman: Orchestration_TM.Shared.Order_Consolidation.ToDo" ReceivePortName="" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="RemoveOutboundTransformFromSendPort" SendPortName="TM.Bosman: TM.Shared.OrderStatus_to_TM.Bosman.IFTSTA" ReceivePortName="" OrchestrationName="" TransformName="TM.Bosman.Transforms.TM_Shared_OrderStatus_to_TM_Bosman_IFTSTA" Condition="'$(AppExists)' == 'true'"/>
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="RemoveOutboundTransformFromSendPort" SendPortName="TM.Bosman: TM.Bosman.Reference.Administration" ReceivePortName="" OrchestrationName="" TransformName="TM.Bosman.Transforms.TM_Bosman_Reference_Administration" Condition="'$(AppExists)' == 'true'"/>
		<!--Stop Receive Ports (optional remove mapping)-->
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Stop" SendPortName="" ReceivePortName="TM.Bosman: TM.Bosman.IFCSUM_Orchestration" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<!--<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="RemoveInboundTransformFromReceivePort" SendPortName="" ReceivePortName="ReceivePortExample" OrchestrationName="" TransformName="ReceivePortTransformExample" Condition="'$(AppExists)' == 'true'"/>-->
	</Target>
	<Target Name="StartApplication" Condition="'$(StartApplicationOnDeploy)' == 'true'">
		<Message Text="-&gt; Override StartApplication"/>
		<Message Text="Starting $(BizTalkAppName) application at $(StartApplicationTime)."/>
		<Message Text="Note: Starting the app may take 5-10 secs PER ORCHESTRATION. Please wait..."/>
		<!--Start Send Ports-->
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Start" SendPortName="TM.Bosman.Orchestrations_3.0.3.0_TM.Bosman.Orchestrations.TM_Bosman_Orchestrations_IFCSUM_Mail_Send_ef8f53020aeb0dca" ReceivePortName="" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Start" SendPortName="TM.Bosman: TM.Shared.OrderStatus_to_TM.Bosman.IFTSTA" ReceivePortName="" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Start" SendPortName="TM.Bosman: TM.Bosman.Reference.Administration" ReceivePortName="" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Start" SendPortName="TM.Bosman: Orchestration_TM.Shared.Order" ReceivePortName="" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Start" SendPortName="TM.Bosman: Orchestration_TM.Shared.Order_Consolidation.ToDo" ReceivePortName="" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<!--Start Receive Ports-->
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Start" SendPortName="" ReceivePortName="TM.Bosman: TM.Bosman.IFCSUM_Orchestration" OrchestrationName="" Condition="'$(AppExists)' == 'true'"/>
		<!--Start Orchestrations-->
		<ControlBizTalkArtefacts ApplicationName="$(BizTalkAppName)" Command="Start" SendPortName="" ReceivePortName="" OrchestrationName="TM.Bosman.Orchestrations.TM_Bosman_Orchestrations_IFCSUM" Condition="'$(AppExists)' == 'true'"/>
	</Target>
	<!-- ============ END Deployment OVERRIDE ============ -->
</Project>

