Use settings spreadsheet to control enable receive location on deploy setting

Topics: Bindings File, Settings Management and SSO, Server Deployment
Aug 23, 2013 at 9:53 PM
I'd like to be able to use the settings spreadsheet to change the value of EnableAllReceiveLocationsOnDeploy on a per environment basis, but it doesn't seem to be working.

I created a new setting named EnableReceiveOnDeploy, and set it to False on 2 of my environments and True for the others, then updated the PropsFromEnvSettings item (like so: <PropsFromEnvSettings Include="SsoAppUserGroup;SsoAppAdminGroup;EnableReceiveOnDeploy" />). But when deploying to the environments where the receive locations should not be started, they do get started. I've even checked the setting value by echoing it using a custom deploy target, and it does show as False.

So my question is why isn't EnableAllReceiveLocationsOnDeploy taking the setting from the spreadsheet (EnableReceiveOnDeploy), and what do I need to do to get it to?

Thanks in advance.
Coordinator
Aug 23, 2013 at 10:25 PM
I'm not sure why you changed the property name when you put it into the spreadsheet. Change EnableReceiveOnDeploy to EnableAllReceiveLocationsOnDeploy.

Thanks,
Tom
Aug 26, 2013 at 5:06 PM
Sorry I wasn't clear.

I used a different name because I then used that new property to set the value in the btdfproj file like so:
<EnableAllReceiveLocationsOnDeploy>$(EnableReceiveOnDeploy)</EnableAllReceiveLocationsOnDeploy>
I had assumed that if I used the same name as the existing property that there would be conflicts. Are you saying that I can just directly override the value of EnableAllReceiveLocationsOnDeploy by adding it to the settings spreadsheet?

When I try that it seems to ignore the value in the spreadsheet and just take the value in the btdfproj file.

Thanks for your assistance.
Coordinator
Aug 26, 2013 at 6:45 PM
Correct, you can directly override a property using the actual property name. You'll want to completely remove the property from your .btdfproj and allow it to always be set from the settings spreadsheet.

Thanks,
Tom
Aug 26, 2013 at 7:24 PM
Is there anything else that could override that value? I set the EnableAllReceiveLocationsOnDeploy to false in my settings spreadsheet, the exported settings file correctly showsEnableAllReceiveLocationsOnDeploy as being false, but when deploying the receive locations are still started, and checking the value using a message in the CustomDeployTarget shows EnableAllReceiveLocationsOnDeploy=true.

Thanks for the quick responses.
Coordinator
Aug 26, 2013 at 9:54 PM
OK. Unfortunately this is another example of MSBuild's order of evaluation of properties making things harder. When MSBuild loads the .btdfproj and all of its imported targets files, it evaluates the property values. The only thing that can get ahead of that is explicit property declarations in the .btdfproj, command-line parameters and environment variables.

The problem is that we create properties from the settings spreadsheet AFTER that load process is complete. The underlying property that controls this behavior, ControlBizTalkAppStartOption, has already been evaluated by the time this property is loaded from the settings spreadsheet.

One of the limiting factors on this is MSBuild 2.0 which is the common denominator due to our BizTalk 2006 R2 support. I'd have a bit more flexibility on this with MSBuild 3.5.

One workaround is a bit ugly -- redefine the property at runtime with the CreateProperty task in your .btdfproj. You can try this out. It's not ideal for future upgrades so you may have to undo or change it at some point in the future.
<Target Name="RedefinePropertiesAfterSettingsSpreadsheet" AfterTargets="SetPropertiesFromEnvironmentSettings">
  <CreateProperty Value="StartAll" Condition="'$(EnableAllReceiveLocationsOnDeploy)' == 'true' and '$(StartReferencedApplicationsOnDeploy)' == 'true'">
    <Output TaskParameter="Value" PropertyName="ControlBizTalkAppStartOption" />
  </CreateProperty>
  <CreateProperty Value="StartAllOrchestrations,StartAllSendPortGroups,StartAllSendPorts,DeployAllPolicies,StartReferencedApplications" Condition="'$(EnableAllReceiveLocationsOnDeploy)' == 'false' and '$(StartReferencedApplicationsOnDeploy)' == 'true'">
    <Output TaskParameter="Value" PropertyName="ControlBizTalkAppStartOption" />
  </CreateProperty>
  <CreateProperty Value="StartAllOrchestrations,StartAllSendPortGroups,StartAllSendPorts,DeployAllPolicies,EnableAllReceiveLocations" Condition="'$(EnableAllReceiveLocationsOnDeploy)' == 'true' and '$(StartReferencedApplicationsOnDeploy)' == 'false'">
    <Output TaskParameter="Value" PropertyName="ControlBizTalkAppStartOption" />
  </CreateProperty>
  <CreateProperty Value="StartAllOrchestrations,StartAllSendPortGroups,StartAllSendPorts,DeployAllPolicies" Condition="'$(EnableAllReceiveLocationsOnDeploy)' == 'false' and '$(StartReferencedApplicationsOnDeploy)' == 'false'">
    <Output TaskParameter="Value" PropertyName="ControlBizTalkAppStartOption" />
  </CreateProperty>
</Target>
Thanks,
Tom
Aug 26, 2013 at 11:27 PM
Still no luck.

Every time it still starts the receive locations. Using some Message statements, it looks like the settings spreadsheet property values aren't available at that point in execution, at least they all return blank. The only exception is EnableAllReceiveLocationsOnDeploy which returns true, I assume because it's a BTDF property and true is the default value.

Thanks for your help thus far though.
Coordinator
Aug 27, 2013 at 6:39 AM
Please verify that you updated PropsFromEnvSettings to include EnableAllReceiveLocationsOnDeploy. The AfterTargets causes the new target to run immediately after PropsFromEnvSettings is processed, so if EnableAllReceiveLocationsOnDeploy is in the exported XML file then it should certainly have a value within the new target using <Message Text="EnableAllReceiveLocationsOnDeploy='$(EnableAllReceiveLocationsOnDeploy)'" />. I'm assuming that you are seeing this target execute right after SetPropertiesFromEnvironmentSettings.

Also be sure to remove all property definitions for EnableAllReceiveLocationsOnDeploy. It will always end up with a value of true by default. Are you testing all of this by deploying from Visual Studio?
Aug 28, 2013 at 4:21 PM
That was the problem. I missed adding EnableAllReceiveLocationsOnDeploy to PropsFromEnvSettings. It's working now.

Thanks for all you help! And a not inconsiderable amount of patience.
Coordinator
Aug 29, 2013 at 4:10 AM
OK great, you're welcome! Now that you have the property definition working you could try it without the extra target... but I'm pretty sure that you'll have to keep it.

Thanks,
Tom
Aug 29, 2013 at 7:56 PM
Yes, once it started working I actually tried that, but it didn't work without the additional target.

Still, it's working now, and I'm happy.

Thanks again.