The exception when running as the console application as Azure webjob:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Azure.Core, Version=1.0.2.0, Culture=neutral, PublicKeyToken=92742159e12e44c8' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Locally this works and runs.
Referencing:
So of course based on these nuspec specifications it should resolve to Azure.Core 1.6.0. Which it locally does and runs without a problem.
Yet when I deploy this using VS publish profile to our cloud as Azure Webjobs and run the application I get the exception mentioned above. (of course the file version deployed is the same as local, version 1.6.0)
I know I can fix this with an assemblybinding. Stating that version 0.0.0.0 to 1.6.0.0 should resolve to version 1.6.0.0.
But I find this very frustrating because it imposes manual labor and keeps us from updating packages whenever a newer version arrives because then we also have to remind ourselves to update the assemblybindings.
I feel like there is a better solution, or we are doing something wrong. But I simply do not know where to begin searching for a solution. I hope to get some insights from you guys!
PS:
This phenomenon is driving me nuts because we face similar issues when using packages:
Because they both depend on Unity.Container. Forcing us to either use assemblybinding to resolve this issue, or only use versions which depend on the same packages
Try doing the following steps because the approach you are taking is correct:
Azure.Identity
and Azure.Security.KeyVaults.Secrets
nuget packages.bin
and obj
folders in your project folder.Azure.Core version >= 1.6.0
and rebuild the solution.These should work ideally. I think that there are some stale dependencies which are getting deployed. You can also try deploying through pipelines, if not already doing.
User contributions licensed under CC BY-SA 3.0