Application maintenance
ASP.NET Core Azure App Services Azure Function Diagnostics Visual Studio

Resolving Error For Microsoft.AspNetCore.Mvc.Abstractions After Updating Azure Function V2 Tools

Welcome to today’s post.

I will show an error that I have experienced while deploying a serverless function to Azure from Visual Studio 2017.

I will also show a workable solution (hack?) to the error. Below is the error I get when I try running the Azure serverless function locally:

'Microsoft.AspNetCore.Mvc.Abstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT:

Clearly this is not a helpful error.

Luckily, I did reproduce my steps, and the initial cause of the problem was due to this action below, updating the build tools:

Following this update, the build tools version went up to v1.0.29 as shown:

I will go through the steps I tool to revert this back to the last known good version that didn’t break the azure function tool.

First, open the folder AppData\Local\AzureFunctionTools\Releases.

Locate the latest release folder that contains binaries for the tools:

Next, open the folder AppData\Local\AzureFunctionTools\

Open the file feed.json.

Go to the tag corresponding to the folder you found above.

Make a note of the version of Microsoft.NET.Sdk.Functions. In this case it is 1.0.13.

    "1.0.10": {
      "Microsoft.NET.Sdk.Functions": "1.0.13",
      "cli": "https://functionscdn.azureedge.net/public/1.0.10/Azure.Functions.Cli.zip",
      "localEntryPoint": "func.exe",
      "itemTemplates": "https://www.myget.org/F/azure-appservice/api/v2/package/Azure.Functions.Templates/1.0.3.10178",
      "projectTemplates": "https://www.myget.org/F/azure-appservice/api/v2/package/Microsoft.AzureFunctions.ProjectTemplates/1.0.3.10178",
      "templateApiZip": "https://functionscdn.azureedge.net/public/TemplatesApi/1.0.3.10178.zip",
      "sha2": "...",
      "FUNCTIONS_EXTENSION_VERSION": "~1"
    },

Next, open the NuGet packages for the project.

You will see the Microsoft.NET.Sdk.Functions and the current version.

Select the Version drop down:

Select version 1.0.13.

Click Install.

After installing, check the version under NuGet in your project dependencies:

The downgraded version should be there.

Next, test the downgrade was successful by running the Azure function locally:

You should see no errors when the host runs.

And the function should execute with no library errors.

That’s all for todays post.

I hope it has been informative and useful.

Social media & sharing icons powered by UltimatelySocial