azure-functions-core-tools icon indicating copy to clipboard operation
azure-functions-core-tools copied to clipboard

Error message "Could not load file or assembly 'Microsoft.AspNetCore.Authentication.JwtBearer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified." when launching local emulator.

Open richardg1 opened this issue 10 months ago • 6 comments

Version

Azure Functions Core Tools Core Tools Version: 4.0.6821 Commit hash: N/A +c09a2033faa7ecf51b3773308283af0ca9a99f83 (64-bit) Function Runtime Version: 4.1036.1.23224

Powershell Version PSVersion 7.4.7 PSEdition Core GitCommitId 7.4.7 OS Microsoft Windows 10.0.19045 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

Description

Getting error message "Could not load file or assembly 'Microsoft.AspNetCore.Authentication.JwtBearer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified." when attempting to run azure functions core emulator from vscode or Powershell command line.

Steps to reproduce

Using a simple Powershell azure function based on the out of the box template getting the the following error when it attempts to run the "func host start" command.

Could not load file or assembly 'Microsoft.AspNetCore.Authentication.JwtBearer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

Also getting the same error if I switch to the folder containing my Powershell based Azure function and run attempt to start the emulator with "func host start"

richardg1 avatar Feb 04 '25 17:02 richardg1

I had this same issue and I was able to fix it by simply uninstalling and reinstalling Functions Core Tools.

Microsoft.AspNetCore.Authentication.JwtBearer.dll was missing from the program files, and it came back after I reinstalled. I should note that I previously updated the app through winget, so maybe something bad happened during the upgrade?

n0spaces avatar Feb 06 '25 20:02 n0spaces

@n0spaces @richardg1 I had the same problem. The problem was that I had 2 versions of function core tool installed: the latest one and 4.0.5907 version. Uninstalling the latest version solved the problem.

pieroci avatar Feb 19 '25 11:02 pieroci

Hi @richardg1, how did you install core tools?

Do you mind trying the two suggestions above and let us know if you are still experiencing this issue?

  1. Double check you only have 1 version of core tools installed
  2. try uninstalling all core tools instances and reinstall

liliankasem avatar Feb 22 '25 00:02 liliankasem

I had the same issue. As mention before here it worked by uninstalling and then reinstalling Functions Core Tools.

Version used: Azure Functions Core Tools Core Tools Version: 4.0.6821 Commit hash: N/A +c09a2033faa7ecf51b3773308283af0ca9a99f83 (64-bit) Function Runtime Version: 4.1036.1.23224

eobr1 avatar Feb 25 '25 10:02 eobr1

I ran into the same issue - turned out I had two versions of Core Tools installed: one via MSI and another via npm. Reinstalling through npm didn’t fix it, and func --version kept showing 4.0.6821, even though the latest version is 4.0.7030.

It turns out that while npm install did install the latest version (4.0.7030), func --version was still pointing to the older MSI-installed version. I had to go to Apps > Installed Apps on Windows and uninstall the MSI version to fully resolve the conflict.

MadhuraBharadwaj-MSFT avatar May 14 '25 03:05 MadhuraBharadwaj-MSFT

Reopening this as I think it is a still valid open issue, and the bot automation closure doesn't mean we don't still look into this.

mattchenderson avatar May 14 '25 16:05 mattchenderson

I had the same issue from cmd line and vscode with core tools version 4.0.7512. Repairing it (from add/remove programs) resolved this issue.

ravindrank avatar Jul 09 '25 04:07 ravindrank

It looks like this is related to the issue discussed in #3602 where MSI installations are skipping some files during installation, when going from one version of the CLI to the next. The workaround is to repair or uninstall/reinstall the CLI. Going to close this as a dupe whilst we track investigation of the bug in the other issue

liliankasem avatar Jul 15 '25 21:07 liliankasem