Solving Azure Functions and WebJobs Tools update issue with Visual Studio — Could not load file or assembly ‘Microsoft.AspNetCore.Http.Abstractions,

Tsuyoshi Ushio
4 min readOct 25, 2018

When I have a Serverless Openhack with our customers, we encounter the updating issue of the Azure Functions and WebJobs tools of the Visual Studio 2017. My very cool colleague Hannes (twitter: @HannesN) . Solve the problem. I’d like to share the workaround.

Problem

Currently, Azure Functions and Web Jobs Tools automatically update it’s self. However, some people encounter this issue. For example, if they use HttpTrigger, it’s no problem. However, once add the Microsoft.Azure.WebJobs.Extensions.CosmosDB then start debugging, you might see this error. It is not happen all the people.

[2018/10/23 9:22:44] Reading host configuration file 'C:\Users\ushio\source\repos\FunctionApp1\Ice\bin\Debug\netstandard2.0\host.json'[2018/10/23 9:22:44] Host configuration file read:[2018/10/23 9:22:44] {}[2018/10/23 9:22:44] Starting Host (HostId=desktopdtqf18l-2079663756, InstanceId=75afeb98-e25e-45f3-a565-7a0681c7dff1, Version=2.0.11651.0, ProcessId=13796, AppDomainId=1, Debug=False, ConsecutiveErrors=2, StartupCount=3, FunctionsExtensionVersion=)[2018/10/23 9:22:44] Unable to configure java worker. Could not find JAVA_HOME app setting.[2018/10/23 9:22:44][2018/10/23 9:22:44] Could not configure language worker Java.[2018/10/23 9:22:44][2018/10/23 9:22:45] A ScriptHost error has occurred[2018/10/23 9:22:45] System.Private.CoreLib: Could not load file or assembly 'Microsoft.AspNetCore.Http.Abstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.AspNetCore.Http.Abstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.[2018/10/23 9:22:45] Stopping Host

Root cause

The error message is not obvious, however, this issue caused by old version of the func command. Inside of the extension, it uses the Auzre Functions Core Tools. It should be updated automatically, however in some reason, it is not successful.

How to solve this?

You can find the current Auzre Function Core tool which is automatically installed by Visual Studio under the %localappdata%\AzureFunctionsTools e.g. C:\Users\ushio\AppData\Local\AzureFunctionsTools. All you need is get this directory from your colleague and copy that.

Make sure the Azure Functions and Web Jobs Tools version is 15.10.2046 or latest

Go to Tools > Extension and Updates > Updates . Make sure there is no update of the Azure Functions and Web Jobs Tools update.

Change the version to the latest

If the latest is 2.10.1, Change the content of

%localappdata%l\AzureFunctionsTools\Tags\v2\LastKnownGood file to 2.10.1

LastKnowGood have a current version. change to it.

Copy the latest from your friend

Copy the folder %localappdata%\AzureFunctionsTools\Releases\2.10.1 from someone else’s machine (in our case it remained empty on the effected user for some reason)

Change the directory fit to your environment

Edit %localappdata%\AzureFunctionsTools\Releases\2.10.1\manifest.json by changing the username referenced in CliEntryPointPath and TemplatesDirectory to the current user’s name.

This workaround works in many cases. In case you don’t have a friend who have a valid environment, I have other suggestion. I didn’t try this. However, it might help.

Make sure the Azure Functions and Web Jobs Tools version is 15.10.2046.

Close all instances of VS

Open %localappdata%AzureFunctionsTools

Rename %localappdata%\AzureFunctionsTools to AzureFunctionsTools_bak

Rename %localappdata%\.templateengine to templateengine_bak

Open VS, make sure you have good network connection, since this will be a sizeable download.

Go to File -> New -> Project -> Azure Functions -> Click OK

You should see the New Project dialog box

Wait for the update to complete

Alternetives

It is not recommended, however, you can see the other workaround in my blog. It is way to override the func command by changing debugging settings. However this strategy doesn’t upgrade your Azure Functions and Web Jobs tools automatically. So I don’t recommend. If possible you can try the above two.

Other notes

You might need to upgrade dotnet sdk (for V2, it is .Net core). if it is very old.

Make sure you don’t use the old version of these two.NETStandard.Library depends on the dotnet sdk version.

I hope this helps.

--

--