azure-functions-host: Visual Studio Failing to Install Latest CLI runtime

I am busy upgrading my function app to the latest version of the azure function runtime, but get this error when I try to run the function from Visual Studio.

Could not load type ‘Microsoft.Azure.WebJobs.ExecutionContext’

Function App Version 2.0 Trying to debug in Visual Studio on Windows Machine

References:

  • Microsoft.Azure.WebJobs : 3.0.0
  • Microsoft.Azure.WebJobs.Core : 3.0.0
  • Microsoft.Azure.WebJobs.Extensions.Storage : 3.0.0
  • Microsoft.NET.Sdk.Functions : 1.0.24

Host.json:

{
  "version": "2.0",
  "healthMonitor": {
    "enabled": true,
    "healthCheckInterval": "00:00:10",
    "healthCheckWindow": "00:02:00",
    "healthCheckThreshold": 6,
    "counterThreshold": 0.80
  },
  "logging": {
    "applicationInsights": {
      "sampling": {
        "isEnabled": true,
        "maxTelemetryItemsPerSecond": 5
      },
      "snapshotConfiguration": {
        "isEnabled": false
      },
      "categoryFilter": {
        "defaultLevel": "Information",
        "categoryLevels": {
          "Host.Results": "Error",
          "Function": "Error",
          "Host.Aggregator": "Information"
        }
      }
    }
  },
  "extensions": {
    "queues": {
      "batchSize": 16,
      "visibilityTimeout": "00:00:30",
      "maxDequeueCount": 3
    }
  }}

I also tried installing v 3.0.1 of Microsoft.Azure.WebJobs and the Storage extensions package, but that doesn’t seem to work as the functions package is not compatible with that version.

I’m not sure what else there is for me to do, but it is pretty frustrating to try and get this upgrade done. Everything I have found on this error leads to posts and stuff that needs to happen in the Azure Portal - I can’t even get it running locally, so that won’t help me. In the portal, my function app is currently pinned to the alpha version and urgently need to get it upgraded as there are other fixes that I want to get into production.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 70 (33 by maintainers)

Most upvoted comments

@mieliespoor and @bbramsted I have put together an automated script to download the place the relevant artifacts in the correct location. Please find the relevant instructions in this wiki page.

You should see a dialog downloading the matching version.

the matching version?

image

Dialog doesn’t have any version mentioned in it?

I have deleted %localappdata%\AzureFunctionsTools and restarted visual studio. It keeps on installing Version=2.0.11651.0.

Just learnt about this and … same thing here.

This is what my file system looks like AFTER I deleted the AzureFunctionsTools folder and then hit F5 on my function, to start it, which that dialog (above) popped up for a bit…

image

Ok, so noticed a few things:

  • There’s 2x folders under Releases
  • One folder is a BETA
  • 2.0.1-beta.25 has files in it
  • 2.11.1 is newer (following semver) but has no files/folders in it.
[13/11/2018 12:45:51 AM] Starting Host (HostId=purekromepc2-1691422614, InstanceId=b74eeb3b-160d-47ae-baf3-78680d83e45d, Version=2.0.11651.0, ProcessId=2860, AppDomainId=1, Debug=False, ConsecutiveErrors=8, StartupCount=9, FunctionsExtensionVersion=)

image

From 16.4 VS switched to using x64 version of cli. However the x64 version of CLI being used is not minified like x86. The core tools x64 zip file is 140 mb (x64) vs 50 mb (x86) and the same extracted is 350 mb (x64) vs 112 mb (x86). This would be the likely reason for issues.

In the meantime the workaround for this is tedious but should unblock you. Here are the work around steps.

  1. delete %userprofile%.templateengine
  2. delete contents of %userprofile%\AppData\Local\AzureFunctionsTools
  3. download and extract the following zip file into %userprofile%\AppData\Local\AzureFunctionsTools
  4. The manifest file in the zip points to a different user account. You would have to replace it with the corresponding path.

This is happening to one person in our (internal Microsoft) team since we upgraded to Azure Functions v3 and .Net Core 3.1. Whenever they log in to any machine with the same work account and they try to run our code from Visual Studio 2019 16.4.2:

  • Tools download prompt shows up
  • Code fails to run
  • AppData\Local\AzureFunctionsTools\Releases\3.2.0 is completely empty

If I follow the same steps on the same machines it works fine for my own work account. So I am guessing this has something to do with their account?!

Update: He also ran the Powershell script and surprisingly that did not help. Deleting AzureFunctionsTools folder, deleting templateengine, and clearing Visual Studio 2019 settings also does not help.

So, I doubt this problem is resolved and this bug should not be closed.

Yes.

This should be fixed now, We have published an update to significantly reduce the on start up. Create the following folder structure to reduce the download payload further.

  1. %userprofile%\AppData\Local\AzureFunctionsTools\Releases\2.33.0\<emptyfolder>
  2. %userprofile%\AppData\Local\AzureFunctionsTools\Releases\2.36.0\<emptyfolder>
  3. %userprofile%\AppData\Local\AzureFunctionsTools\Releases\2.37.0\<emptyfolder>

@RufusJWB I don’t think choco install messed up your VS, since VS downloads its own copy of core tools. Re-opening the issue to find the root cause of the issue.

Reactivating while we work with @zmarty to get to the bottom of what is going on.

@soninaren This typo mentioned needs fixing in wiki. Thanks for your effort.

Thanks @soninaren . I downloaded the AzureFunctionsTools.zip and all started to work. Thank you everyone who assisted in resolving this!

@soninaren Yes, that did the trick, after a bit of fiddling.

First I replaced the AzureFunctionTools folder with the zip file and removed the .templateengine directory. The new project dialog showed just a single project (Empty) and when I tried to use it, gave an error.

Running the script then gave an error: https://www.nuget.org/api/v2/package/Microsoft.Azure.WebJobs.ItemTemplates/2.0.10321 System.Exception: HTTP status 404: The requested URL does not exist on the server.

I then removed the Azure workload in VS installer, cleaned the two folders, and reinstalled the Azure workload. Then I unzipped the AzureFuntionTools file, before starting VS. Now the new project dialog again checked for updates, and got the new 2.11.3.

Thanks for the help!