Visual Studio代码:缺少X509Certificate2UI

时间:2017-01-30 23:24:15

标签: visual-studio-code .net-core x509certificate2 system.security

尝试在VS代码中使用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"
    }

非常感谢任何帮助:)

-Nate

1 个答案:

答案 0 :(得分:0)

X509Certificate2UI不是.NET Core的一部分。它是一个仅限Windows的类,并且是一个UI类,它没有被继承。

您必须转移到无UI解决方案,或交叉编译以定位.NET Framework。