在 .net 核心应用程序中使用 ActiveDirectory.Platform

Using ActiveDirectory.Platform in .net core app

我正在 .net 核心中编写一个控制台应用程序,它使用 Microsoft.IdentityModel.Clients.ActiveDirectory 进行用户身份验证。

nuget 包在 lib\netcore45 文件夹中包含两个文件:

在代码中,我尝试使用 PlatformParameters 对象调用 AcquireTokenAsync 重载:

public async Task<AuthenticationResult> AcquireTokenAsync(string resource, string clientId, Uri redirectUri, IPlatformParameters parameters)

IPlatformParameters 的实现在程序集 Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll 中定义。

.net core 应该如何引用这个程序集? project.json 文件似乎不允许从 nuget 包中选择特定文件...

或者是否有其他方法可以在 .net core 中使用 ActiveDirectory 库?

Netcore45 以 UWP 为目标。 Nuget 应根据需要为每种目标类型自动提取 dll。