Settings file use on Undeploy

Topics: Bindings File, Settings Management and SSO
Dec 1, 2010 at 7:30 PM

I would like to have the BTDF 'remember' the settings file that is used on Deployment.  I would then like the BTDF to use the 'remembered' settings file on Undeployment (the result would be that the settings file that is used on Deployment would also be used on Undeployment without the person doing the Undeployment having to select the correct settings file).  I would like to do this without modifying the BizTalkDeploymentFramework.targets file.

The reason I would like to do this I have a list of BizTalk Hosts that should be restarted on Deployment/Undeployment (I do not want to restart all the Hosts).  The trick is that each environment has a different set of Hosts that should be restarted.  I have the list of Hosts in the settings file.

In past versions of the BTDF I implemented this by modifying the BizTalkDeploymentInclude.nant file (which made me out-of-sync with the rest of the world).  I would like to do the same with the 5.0 version of BTDF.

Coordinator
Dec 1, 2010 at 7:56 PM

Here's an idea (untested):

I think the only trick is re-populating the settings file path at undeploy time.  You could save the settings file path to a text file during deployment in a CustomDeployTarget Target in your .btdfproj.  On a server deploy, it's stored in $(ENV_SETTINGS).  Unfortunately, during undeploy you would need to reload $(ENV_SETTINGS) earlier in the process than the overridable Targets allow.  You'd need to pass the path to the MSBuild command line or do something to reload it from the text file before the undeploy script begins executing.

Assuming that you get $(ENV_SETTINGS) populated/re-populated, add the hosts list setting name from your spreadsheet to the PropsFromEnvSettings property (like <PropsFromEnvSettings Include="SsoAppUserGroup;SsoAppAdminGroup;HostsToRestart" />).  The HostsToRestart values in the spreadsheet would look like Host1;Host2;Host3.  You'll end up with an MSBuild property named HostsToRestart containing your host name list.

Then, you'd add something like this to your .btdfproj:

<ItemGroup>
  <BizTalkHosts Include="$(HostsToRestart)" />
</ItemGroup>

The end result is that the appropriate value is automatically plucked from the spreadsheet and used as the list of hosts to restart.

Let me know how it goes!

Thanks,
Tom

Dec 13, 2010 at 9:00 PM

Hi Tom,

I have been playing around with this and have decided to modify the BizTalkDeploymentFramework.targets file.  I am doing this as it provides the 'cleanest' deployment experience for the developers I am working with.  One thing I would like to understand is why the InitSettingsFilePath target picks a settings file if the ENV_SETTINGS environment variable is not set?  Is it not making an arbitrary selection in this case?  My point in saying this is I would think that the 'normal' undeployment would want to use the same settings file that was used on the deployment and not some other settings file.

 

Does that make sense (I could be missing something)?

 

Thanks for you and Scott's great work on the BTDF.  I use it extensively.

 

Dave

Coordinator
Dec 16, 2010 at 4:49 AM

Thanks Dave!  It's just normal and expected behavior that the settings file path is unknown and empty on a server undeploy.  You'll notice an error message during undeploy that says "invalid settings file path (OK on server undeploy)."  The default settings file path that you're referring to takes effect only on a Visual Studio (Configuration <> "Server") deploy/undeploy, never on a server deploy/undeploy.

The only way to get it set to a valid path during server undeploy would be a workaround like I was describing, or a new feature to save and reload the path between deploy time and undeploy time.

Thanks,
Tom