0
votes

My Xamarin source code builds properly on local machine. But gives error of Microsoft.Bcl.Build.Tasks.dll. Could not load file or assembly on TFS Azure DevOps server.

I already have Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" in every .csproj of my solution still it gives same error while building the CI.

Error thrown at Azure DevOps:

packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets(97,5): Error MSB4062: The "EnsureBindingRedirects" task could not be loaded from the assembly D:\a\3\s\ACI_GPS\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.Tasks.dll. Could not load file or assembly 'file:///D:\a\3\s\ACI_GPS\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. Process 'msbuild.exe' exited with code '1'.

Project builds successfully at local but not on TFS DevOps pipeline(CI). I'm trying multiple solution but nothing is working.

1
Are you using the NuGet task in your build? Are you using task to restore your NuGet packages at the beginning of your build?Merlin Liang - MSFT
@MerlinLiang-MSFT Yes. I'm using Nuget task and nuget restore.Snehal Jadhav
Do you use the “Nuget Tool Installer” task to specified the Nuget version?Merlin Liang - MSFT
Check if the package and its dll is restored to the correct location. You can find it in the logging of the NuGet Restore task but be sure the 'Verbosity' option in the NuGet restore task is set to 'Detailed' . Default it will restore it in the packages folder on the same level as the solution file, it that the correct location for your case?miezke
@miezke, It builds and runs properly on the local MAC machine, It means I have .dll file at the correct location. After pushing it to TFS it gives build error.Snehal Jadhav

1 Answers

0
votes

Resolved the issue by below steps:

  • Downgrade Microsoft.Bcl.Build to a previous version 1.0.14.
  • Restore packages and rebuild.

Similarly for Azure Devops , try Microsoft.Bcl.Build with 1.0.14 version.

Hope it helps.