Skip to content

Could not load file or assembly Microsoft.IdentityModel.Tokens (related to _FunctionsSkipCleanOutput) #7878

@srmagura

Description

@srmagura

A newly-created Azure Functions project fails to load Microsoft.IdentityModel.Tokens even when the .csproj file contains a PackageReference to the Microsoft.IdentityModel.Tokens NuGet package.

Investigative information

N/A, this issue is reproducible locally.

Repro steps

  1. Clone my repo: https://github.com/srmagura/FunctionsAssemblyLoadingRepro
  2. Open the solution file in Visual Studio 2022.
  3. Run the project.
  4. Go to http://localhost:7071/api/Function1 in your web browser.

Expected behavior

There should be no errors in the debug window. The browser should display the text "Function executed."

Actual behavior

An error message is displayed in the debug window:

System.Private.CoreLib: Exception while executing function: Function1. FunctionsAssemblyLoadingRepro: Could not load file or assembly 'Microsoft.IdentityModel.Tokens, Version=6.14.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

Known workarounds

Add <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput> to the .csproj file. This is a workaround, not a solution, because this property is internal and undocumented.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bot: do not closePrevents bot automation from closing issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions