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

 

/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

 

C:Program Files (x86)MSBuildMicrosoftBizTalkBizTalkCommon.targets (189): The "AddBizTalkHiddenReferences" task failed unexpectedly.  
System.ArgumentNullException: Value cannot be null.  
Parameter name: path1  
   at System.IO.Path.Combine(String path1, String path2)  
   at Microsoft.VisualStudio.BizTalkProject.Base.HiddenReferencesHelper.InitializeHiddenReferences()  
   at Microsoft.VisualStudio.BizTalkProject.Base.HiddenReferencesHelper.get\_HiddenReferences()  
   at Microsoft.VisualStudio.BizTalkProject.Base.HiddenReferencesHelper.GetHiddenReferencesNotAdded(IList\`1 projectReferences)  
   at Microsoft.VisualStudio.BizTalkProject.BuildTasks.AddBizTalkHiddenReferences.Execute()  
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()  
   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

 

/ADDLOCAL ProjectBuildComponent

but

 

/ADDLOCAL WMI,BizTalk,AdditionalApps,ProjectBuildComponent 

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