As you may know, the BizTalk Deployment Framework can help you use different settings for different environments. However, you can also easily use it to have completely different ports in different environments. So for example, if you have use a webservice in your test and production environment, but want to use file locations in your development environment, this can be easily done.
Start by making sure you have the following lines in your .btdfproj file inside of the first PropertyGroup:
<RequireXmlPreprocessDirectives>true</RequireXmlPreprocessDirectives> <FilesToXmlPreprocess>Portbindings.xml</FilesToXmlPreprocess> |
Next, in your SettingsFileGenerator.xml, add a property Environment, and set it’s values for your various environments, as following:
Here we have a default setting, Development, and separate settings for Test and Production.
Now switch to your PortBindingsMaster.xml, and add the various ports and receive locations you want for your different environments. Enclose the ports as following:
<!-- #if GetProperty("Environment")=="DEV" --> <SendPort Name="Work on user" IsStatic="true" IsTwoWay="true" BindingOption="0"> . . <SendHandler Name="${SendHost}" HostTrusted="false"> <TransportType Name="FILE" Capabilities="11" ConfigurationClsid="5e49e3a6-b4fc-4077-b44c-22f34a242fdb" /> </SendHandler> . . <!-- #endif --> <!-- #if GetProperty("Environment")=="TEST" --> <SendPort Name="Work on user" IsStatic="true" IsTwoWay="true" BindingOption="0"> . . <SendHandler Name="${SendHost}" HostTrusted="false"> <TransportType Name="WCF-BasicHttp" Capabilities="899" ConfigurationClsid="467c1a52-373f-4f09-9008-27af6b985f14" /> </SendHandler> . . <!-- #endif --> |
One thing to note, since we have defined RequireXmlPreprocessDirectives, is that we need to enclose all other placeholders as well, for example as following:
<!-- #ifdef _xml_preprocess --> <Tracking>${TrackingSendPort}</Tracking> <!-- #endif --> |
Pingback: Scott Banwart's Blog › Distributed Weekly 197
Hi Eldert,
You can also use an entirely differt binding by simply specifying a binding file in the settings. This could be usefull, if you don’t know all of the environments in advance and want to be flexible, or don’t want to ‘manually’ alter the binding file with macros.
http://snefs.blogspot.nl/2012/06/btdfuse-different-binding-for-test-as.html
See also https://biztalkdeployment.codeplex.com/discussions/226299