MULTILINE EXEC : BizTalk deployment (BTDF), or a gotcha in MSBUILD don’t know but there is a workaround….

I use the BizTalk Deployment Framework (BTDF) a lot for deployment of BizTalk solutions.
BTDF is using MSBUILD tasks to deploy a assembly.

Last week we found a problem with deployment of a specific solution. The problem was MS-BUILD was not performing as expected.
We had a task that looked like this.....

     Command="&quot;$(BtsDir)Trackingbm.exe&quot; add-account -View:&quot;%(BAMViewsAndAccountsGroup.viewName)&quot; -AccountName:&quot;%(BAMViewsAndAccountsGroup.groupNames)&quot;"
     ContinueOnError="true" Condition="'$(BAMViewsAndAccounts)' != ''"/> 

The command would fail but since ContinueOnError was set to true the build would continue as if nothing had happened.
However... This build above was called by another build. And the original toplevel build would still fail !!!

I have looked everywhere and after a lot of googeling finally I found that the MsBuild task EXEC is by default MULTILINE....

This solved my problem very quickly. I changed the command to:

     Command="&quot;$(BtsDir)Trackingbm.exe&quot; add-account -View:&quot;%(BAMViewsAndAccountsGroup.viewName)&quot; -AccountName:&quot;%(BAMViewsAndAccountsGroup.groupNames)&quot; > null
                             Exit 0"
     Condition="'$(BAMViewsAndAccounts)' != ''"/> 

And now the build complestes with succes.
Not the most elegant solution but it does the job...