AddBizTalkHiddenReferences error in TFS build when installing ProjectBuildComponent via a command line setup

I have been trying to script the installation of all the tools and SDKs we need on our TFS Build Agent VMs. This included BizTalk. A quick check on MSDN showed the setup command line parameter I need to install the build components was

1 
2
3/ADDLOCAL ProjectBuildComponent

So I ran this via my VMs setup PowerShell script, all appeared OK, but when I tried a build I got the error

 1 
 2
 3C:Program Files (x86)MSBuildMicrosoftBizTalkBizTalkCommon.targets (189): The "AddBizTalkHiddenReferences" task failed unexpectedly.  
 4System.ArgumentNullException: Value cannot be null.  
 5Parameter name: path1  
 6   at System.IO.Path.Combine(String path1, String path2)  
 7   at Microsoft.VisualStudio.BizTalkProject.Base.HiddenReferencesHelper.InitializeHiddenReferences()  
 8   at Microsoft.VisualStudio.BizTalkProject.Base.HiddenReferencesHelper.get\_HiddenReferences()  
 9   at Microsoft.VisualStudio.BizTalkProject.Base.HiddenReferencesHelper.GetHiddenReferencesNotAdded(IList\`1 projectReferences)  
10   at Microsoft.VisualStudio.BizTalkProject.BuildTasks.AddBizTalkHiddenReferences.Execute()  
11   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()  
12   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d\_\_20.MoveNext()

The strange thing is, if I run the BizTalk installer via the UI and select just the ‘Project Build Components’ my build did not give this error.

On checking the Biztalk setup logs I saw that the UI based install does not run

1 
2
3/ADDLOCAL ProjectBuildComponent

but

1 
2
3/ADDLOCAL WMI,BizTalk,AdditionalApps,ProjectBuildComponent 

Once this change was made to my PowerShell script the TFS build worked OK