Visual Studio 代码:缺少 X509Certificate2UI

Visual Studio Code: Missing X509Certificate2UI

尝试在 VS Code 中使用 X509Certificate2UI 时出现以下错误:

The type or namespace name 'X509Certificate2UI' does not exist in the namespace 'System.Security.Cryptography.X509Certificates' (are you missing an assembly reference?) [netcoreapp1.1]

我发现 few sites 表明解决方案是添加 system.security.dll 程序集,但这些响应似乎并不适合 VS Code。我已经将 X509Certificates 依赖项添加到 project.json 文件,这对我来说似乎没什么用:

 },
  "dependencies": {},
  "frameworks": {
    "netcoreapp1.1": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.1.0"
        },
        "System.Security.Cryptography.X509Certificates": "4.3.0" //"4.3.0-*"
      },
      "imports": "dnxcore50"
    }

任何帮助将不胜感激:)

-内特

X509Certificate2UI 不是 .NET Core 的一部分。就是一个Windows-onlyclass,还有一个UIclass,没结转

您将不得不转向 UI-free 解决方案,或 cross-compile 以面向 .NET Framework。