0
votes

I am unable to build with Azure a solution in .Net 5.0 that references a simple DLL, built in Any CPU / Release on a x64 machine with VS2019. When it attempts to load the DLL, Azure complains :

Warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. Could not load file or assembly 'xxx.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format

The project works fine in local, both projects (the build DLL and the project that Azure have to build) are in .Net 5.0, default "Any CPU" configuration, with nothing special. I would like to keep it in "Any CPU", without to have to define any custom build platform / configuration, as done on development machine.

Here's the (slightly simplified) beginning of the yaml pipeline file :

trigger: - develop

pool: vmImage: 'windows-latest'

variables: solution: './Projects/**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release'

steps:

  • task: NuGetToolInstaller@1

  • task: NuGetCommand@2 inputs: restoreSolution: '$(solution)'

  • task: VSBuild@1 inputs: solution: '$(solution)' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)'

Is there a specific parameter to give to Azure to make it work with the simple already built "Any CPU" DLL ?

1
Yes, thank you, LFS was enabled on the server and this is why the DLL were not properly loaded !AFract

1 Answers

1
votes

In a YAML build, add a checkout step with lfs set to true:

steps:
- checkout: self
  lfs: true

Without it the file will be replaced with a placeholder to the lfs download location.

Here is the ticket you can refer to.