Conditionally Executing 'Quick Deploy' from Visual Studio 2010

Topics: General Questions, Visual Studio Integration
Jul 11, 2014 at 6:52 AM
Edited Jul 11, 2014 at 6:56 AM
Hi Everyone,

I have a Custom Target defined in my btdfproj (as below) to remove existing BizTalk applications on deploy:

<ItemGroup>
      <AppsToRemove Include="BizTalk_Application_ToRemove" />
</ItemGroup>

<Target Name="CustomPostInitialize" Outputs="%(AppsToRemove.Identity)" Condition="<<TheCondition>> and '@(AppsToRemove)' != ''" >
    .
    ..
    ...
    <Exec Command="BTSTask.exe RemoveApp -ApplicationName:&quot;%(AppsToRemove.Identity)&quot;" Condition="'$(AppExists1)' == 'true'" ContinueOnError="true"/>
</Target>


I don't want to this Target to run when I do a 'Quick Deploy' from Visual Studio.
Can anyone please let me know the condition I should use in the dummy placeholder <<TheCondition>>

Thanks in advance :)
Coordinator
Jul 14, 2014 at 4:46 AM
It might be good enough to use "'$(Configuration)' != 'Server' and '$(DeployBizTalkMgmtDB)' == 'false' and '@(AppsToRemove)' != ''".

Thanks,
Tom
Jul 15, 2014 at 7:13 AM
Hi Tom,

I used the above condition but still the CustomPostInitialize Target got executed and removed the other BizTalk Applications (which wasn't intended). Below is the sample output. Can you please help?

CustomPostInitialize:
Removing Application - <<Dependant BizTalk Application>>
Checking for existence of BizTalk application '<<Dependant BizTalk Application>>'...
Found BizTalk application '<<Dependant BizTalk Application>>'.
(Retry count 0)
Stopping <<Dependant BizTalk Application>> application...
Attempting to terminate all service instances for BizTalk app '<<Dependant BizTalk Application>>'...
Terminated 0 service instances for BizTalk app '<<Dependant BizTalk Application>>'.
BTSTask.exe RemoveApp -ApplicationName:"<<Dependant BizTalk Application>>"
Microsoft (R) BizTalk Application Deployment Utility Version 3.9.469.0
Copyright (c) 2010 Microsoft Corporation. All rights reserved.

Information: Removing application "<<Dependant BizTalk Application>>" from BizTalk configuration database (server="Server", database="BizTalkMgmtDb")...
Information: Removed application "<<Dependant BizTalk Application>>".

Command succeeded with 0 errors, 0 warnings.

Thanks,
Mohan
Coordinator
Jul 15, 2014 at 3:03 PM
Have you tried simply using a target named CustomDeployTarget with no Condition instead of CustomPostInitialize? It seems like a more appropriate place for this logic.

Keep in mind that if you just use BTSTask.exe to remove the apps, you're not doing a lot of work that proper BTDF undeploys would do.

Thanks,
Tom