azure-functions-host
azure-functions-host copied to clipboard
Reference Microsoft.Identity.Web 1.25.1 - Could not load file or assembly Microsoft.IdentityModel.Logging
Microsoft.Net.SDK.Functions 4.1.1 .net6 Azure Functions Host 4.6.1 (via core-tools in visual studio)
I have a library that references Microsoft.Identity.Web 1.25.1 which is referenced by my functions project. At runtime I get "Microsoft.Identity.Web: Could not load file or assembly 'Microsoft.IdentityModel.Logging, Version=6.20.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified."
Previously my library had referenced Microsoft.Identity.Web 1.23.1 and it was working.
For my functions project Microsoft.IdentityModel.Logging exist in top bin folder, but not the nested bin folder. If I copy to nested bin folder manually it runs without issue.
It works fine if my library references Microsoft.Identity.Web 1.25.0.
Looks like there is a new dependency in Microsoft.Identity.Web 1.25.1. Microsoft.IdentityModel.LoggingExtensions which itself has a dependency on Microsoft.IdentityModel.Abstractions.
It works if I add this to function csproj
then the Microsoft.IdentityModel.Logging file exist in the nested bin folder and no exceptions.
I dont know what all this would affect, so hesitant to use this work around.
any other info needed from me?
hi @czb182 I don't know if it's still useful but based on this message I believe the _FunctionsSkipCleanOutput
is safe to be used
hi @czb182 I don't know if it's still useful but based on this message I believe the
_FunctionsSkipCleanOutput
is safe to be used
yes, i believe it currently is.
I think there is a 'whitelist' of dll's maintained somewhere in repo here of dll's to copy or not, which I think is proper fix, but not sure. I have not tested latest version to know if still issue or not.
Microsoft.Identity.Web
version 1.25.3
still fails. And it works OK if to downgrade to version 1.25.0
My case: the FunctionApp uses the following packages
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.8.1" />
<PackageReference Include="Microsoft.Identity.Web.MicrosoftGraph" Version="1.25.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
</ItemGroup>
This is still an issue. Was just updating to latest identity.web, 2.7.0 and it is failing on the exact same thing, just different version.
Could not load file or assembly 'Microsoft.IdentityModel.Logging, Version=6.27.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Azure Functions Core Tools Core Tools Version: 4.0.5095 Commit hash: N/A (64-bit) Function Runtime Version: 4.16.5.20396
Can we please get this fixed. I searched online and people are suggested to just use older versions or work around <_FunctionsSkipCleanOutput>true
Adding work around is not practical for me since dozens of functions across a dozen teams and I don't know all the downstream affects that is going to have.
maybe need to add reference to Microsoft.IdentityModel.Logging in webhost? looks like thats what was done for Microsoft.IdentityModel.tokens
https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj
@czb182 I had the same use and was able to resolve using this workaround Basically you need to add this on your csproj file:
<PropertyGroup>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
Yes, im aware of that, and it does fix issue, however I do think that is a proper solution, so requesting one.
@fabiocav
It would be awesome to get this resolved. stuck on Microsoft.Identity.Web 1.15.1 until azure functions can be fixed. MS Identity team doing great work, but then its not consumable because of a different team.