Azure Functions - Referencing the same library as the CLI
I'm working on a precompiled C# Azure Function, and I want to reference a lot of the Microsoft.Extensions dlls. The current version is 2.1.1 for most of these.
However, when I run the project, I get an assembly load error. This seems to be caused by the folder the func.exe file is in comes with most of these dlls, but at version 2.0.0.
If I reference version 2.0.0, then everything works. But is there a way to not have to reference the exact same version as the cli?
This version conflict has been fixed in new version cli. See this related issue and SO thread.
This should be resolved on the latest version of the Azure Functions runtime (2.0.11888, CLI 2.0.1-beta.31).
Have done some tests with Microsoft.Extensions.Configuration 2.1.1. Works as expected.
To consume the latest cli,
If you use Visual Studio to debug,
update Azure Functions and Web Jobs Tools(in menu Tools>Extensions and Updates) to latest version 15.0.40617.0. After update, create a new Azure Function project, wait at the create dialog for VS to download new cli and template.

After a while, we can see the tip change to

On Windows, check whether this folder%LocalAPPDATA%AzureFunctionsToolsReleases2.2.2exists, which contains 2.0.1-beta.31 cli. If the downloading fails, just delete %LocalAPPDATA%AzureFunctionsTools folder and restart VS to download again.
If you use npm, npm i -g azure-functions-core-tools@core --unsafe-perm true. For more choices, see cli installation.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.