0
votes

We are trying to port our build on VSTS hosted agent. We have bunch of DLLs pushed through git lfs to remote. These DLLs work fine on local machine. But when I tried to run build on VSTS hosted agent, one of the DLL got warning MSB3246

C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): Warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. Could not load file or assembly 'FooBar.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format

There are 2 DLLs in our git lfs. I don't see other DLLs success/failure message in log so not sure whether it is working fine or it might also have same issue(this DLL might be breeaking things first).

Obviously, I got errors refering to code from this DLL.

Error CS0234: The type or namespace name 'Foo' does not exist in the namespace 'Bar' (are you missing an assembly reference?)

I found similar issue on https://social.msdn.microsoft.com/Forums/vstudio/en-US/f2d8d30f-62b0-476f-a28e-17e372b6c557/issues-with-build-on-hosted-build-controller?forum=TFService but we already have our gitattributes file set correctly.

What might be going wrong here? Have anyone solved this already?

1
Did you enable git-lfs support for the build definition's Get Sources step?jessehouwing
Thanks, it build fine doing so :) I should have looked at all options more carefully. Thanks for pointing this.k2516
For reference of future visitors, can you please answer this? I will accept your answerk2516

1 Answers

0
votes

In the Get Sources step there is a specific checkbox to enable git-lfs support. Without it the file will be replaced with a placeholder to the lfs download location. Of course you can't compile against those.