Monday, 12 January 2015

Wednesday, 5 November 2014

BizTalk and Continuous Integration


I really enjoy having all my BizTalk code built, deployed and packaged nightly. It strengthens the code and configuration immeasurably. It also limits the little suprises come deployment time and every morning I have fresh msi's available to me, my team and operations.

With the use of a BizTalk build server, a continuous integration tool, Atlassian's Bamboo is my favourite, MSBuild ExtensionPack and some MSBuild scripts, I can easily achieve this... and more.


Create a Bamboo plan that executes an MSBuild Task





Set up some plan variables



Then schedule the plan to run at night


Point the Bamboo task at a MsBuild file like the following:


<Target Name="NightlyBuild">

<!-- Get latest code base -->
<MSBuild.ExtensionPack.VisualStudio.TfsSource TaskAction="Get" ItemPath="$(TeamProject)" Force="true" />

<!-- Compile Solution -->
<Exec Command ="devenv $(ApplicationName).sln /Rebuild $(BuildType)" />
    
<!-- Create application -->
<Exec Command ='"BTSTask" AddApp /ApplicationName:$(ApplicationName)"' />

<!-- Add Biztalk assembly -->
<Exec Command ='"BTSTask" AddResource /Type:System.BizTalk:BizTalkAssembly  /Source:$(ApplicationName).Schemas.dll 
 /Options:GacOnAdd,GacOnInstall,GacOnImport /Overwrite /ApplicationName:$(ApplicationName)'  />

<!--Generate and add binding files-->
<MSBuild Projects="MSBuildBinding.xml" Targets="Generate;AddToApplication" />
    
<!--Export msi--> 
<Exec Command ='"BTSTask" ExportApp  /ApplicationName:$(ApplicationName) /Package:$(ApplicationName).msi' />
    
</Target>


This is just a small taste of what you can achieve with Bamboo and MSBuild.


Friday, 3 October 2014

BizTalk Send port wont enlist

Leaving some white-space in the binding file of a send port filter will make the port unable to enlist. Opening the send port from the admin console will reveal a disabled filter section.





Incorrect:

<Filter>
        &lt;?xml version="1.0" encoding="utf-16"?&gt;
        &lt;Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
        &lt;Group&gt;
        &lt;Statement Property="BTS.ReceivePortName" Operator="0" Value="GetContacts" /&gt;
        &lt;/Group&gt;
        &lt;/Filter&gt;
   </Filter>

Correct:

<Filter>&lt;?xml version="1.0" encoding="utf-16"?&gt;
        &lt;Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
        &lt;Group&gt;
        &lt;Statement Property="BTS.ReceivePortName" Operator="0" Value="GetContacts" /&gt;
        &lt;/Group&gt;
        &lt;/Filter&gt;
   </Filter>

Monday, 29 September 2014

Gac all assemblies in a directory


Installs all assemblies in a particular directory into the global assembly cache from batch file.


@SETLOCAL
@ECHO OFF
@CALL "%VS110COMNTOOLS%vsvars32.bat"

@SET BuildFolder=..\bin\Debug

@ECHO.
@ECHO GAC all project assemblies...


@for %%f in (%BuildFolder%\*.dll) do (

        @echo %%~nf.dll
@gacutil -if %BuildFolder%\%%~nf.dll
    )

@PAUSE
@EXIT
@ENDLOCAL

Execute a batch file from Visual Studio


From the menu select Tools => External Tools

Then add the following:




Sunday, 28 September 2014

SQL job to remove old BizTalk backup files


Run this:

EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1

GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO

Save and schedule this in a sql job:

EXEC xp_cmdshell 'FORFILES /p "D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup" /s /m AU-*.bak /d -1 /c "CMD /C del /Q /F @FILE"'

BizTalk Developer - Interview Question 1.

Rewrite the following xml without using namespace prefixes:


<ns0:RootNode Code="COMP" xmlns:ns0="http://ABC.Schemas.RootNode">
  <Identifier>X984991</Identifier>
  <Products>
    <Product>
      <Code>WW01</Code>
      <Description>Winter Woolies</Description>
    </Product>
  </Products>
</ns0:RootNode>