How to include Windows.Security.Credentials.UI namespace into C# project
See the question and my original answer on StackOverflowWhen using the .NET Framework, you must include the Microsoft.Windows.SDK.Contracts nuget package and then you will have access to (some) WinRT APIs.
Here is a sample C# Console Application:
class Program
{
static async Task Main()
{
await Windows.Security.Credentials.UI.UserConsentVerifier.RequestVerificationAsync("hello world").AsTask();
}
}
It works because this API is marked as DualApiPartition.
Also make sure you're using PackagesReference format for nuget packages and not the packages.config configuration.