KeyVault 2.2 nuget: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory.Platform'
See original GitHub issueDescribe the bug
I utilize one library that requires Microsoft.IdentityModel.Clients.ActiveDirectory >= 4.5.0, however starting with version >= 4 of that library, the dependency namespace ‘Microsoft.IdentityModel.Clients.ActiveDirectory.Platform’ is no longer listed.
The Microsoft.Extensions.Configuration.AzureKeyVault v2.2.0 nuget package requires Microsoft.IdentityModel.Clients.ActiveDirectory >= 3.14.x which does have the required dependency namespace ‘Microsoft.IdentityModel.Clients.ActiveDirectory.Platform’
Microsoft.Extensions.Configuration.AzureKeyVault v2.2.0 crashes on not finding the ‘Microsoft.IdentityModel.Clients.ActiveDirectory.Platform’ dependency because in my solution I am using Microsoft.IdentityModel.Clients.ActiveDirectory v4.5.0.
I cannot downgrade Microsoft.IdentityModel.Clients.ActiveDirectory to 3.19.8 as alot of posts have suggested because my other dependency requires >= 4.5.0.
To Reproduce
Steps to reproduce the behavior:
- Use version ‘2.2.0’ of package ‘Microsoft.Extensions.Configuration.AzureKeyVault’
- Use version ‘4.4.3’ of package ‘Microsoft.Bot.Builder’
- Run this StatelessService code in a .net core project:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new ServiceInstanceListener[]
{
new ServiceInstanceListener(serviceContext =>
new KestrelCommunicationListener(serviceContext, "ServiceEndpoint", (url, listener) =>
{
ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting Kestrel on {url}");
return WebHost.CreateDefaultBuilder()
.ConfigureAppConfiguration((context, config) =>
{
var keyVaultName = "<KEYVAULT NAME>";
var azureServiceTokenProvider = new AzureServiceTokenProvider();
var keyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
config.AddAzureKeyVault(keyVaultName, keyVaultClient, new DefaultKeyVaultSecretManager());
})
.ConfigureServices(
services => services
.AddSingleton<StatelessServiceContext>(serviceContext))
.UseStartup<Startup>()
.UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None)
.UseUrls(url)
.Build();
})),
};
}
Expected behavior
Service starts up and runs.
Failing behavior is that FileNotFoundException is thrown with error Could not load file or assembly ‘Microsoft.IdentityModel.Clients.ActiveDirectory.Platform’
Additional context
Add any other context about the problem here.
$ dotnet --info
Zestaw .NET Core SDK (odzwierciedlenie dowolnego pliku global.json):
Version: 2.2.106
Commit: aa79b139a8
Srodowisko uruchomieniowe:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.106\
Host (useful for support):
Version: 2.2.4
Commit: f95848e524
.NET Core SDKs installed:
1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
1.0.0 [C:\Program Files\dotnet\sdk]
1.0.4 [C:\Program Files\dotnet\sdk]
1.1.0 [C:\Program Files\dotnet\sdk]
2.1.101 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.402 [C:\Program Files\dotnet\sdk]
2.1.403 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
2.1.502 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.2.106 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Issue Analytics
- State:
- Created 4 years ago
- Comments:21 (1 by maintainers)
Top GitHub Comments
I don’t think that’s an option for me as I’m running on dotnet core 3.1 and the 3.14.2 DLL isn’t compatible with that from what I understand.
Moreover, I’m interested in a response from the ASPNet team on the proper fix for this.
Just ran into this as well. The problem is sinister because .Platform it isn’t listed as a direct dependency of anything other than AppAuth. However, forcing AppAuth to 1.4 doesn’t help as something in the configuration extensions IS referencing platform without stating it’s dependency as direct.
Even if this wasn’t breaking, this should be fixed to help customers align various dependency chains where possible.