【发布时间】:2022-01-05 13:56:08
【问题描述】:
我在 Visual Studio 2015 中有一个控制台应用程序。(.Net FrameWork 4.8)
我通过 NuGet 安装向这个应用程序添加了 3 个 dll,如下所示:
System.Security.Cryptography.Algorithms 系统安全密码学编码 System.Security.Cryptography.Primitives
但我在这行 c# 中有错误:
using System.Security.Cryptography.Algorithms;
类型或命名空间名称“算法”不存在于 命名空间“System.Security.Cryptography”(您是否缺少程序集 参考?)
问题是什么,我该如何解决?
【问题讨论】:
-
System.Security.Cryptography.Algorithms是 程序集(DLL)的名称,它不是实际的命名空间 - 所有公共算法实现都有直接命名空间System.Security.Cryptography(即。System.Security.Cryptography.SHA256) -
由于这个错误,我添加了这些 dll:
The type or namespace name 'AesGcm' could not be found (are you missing a using directive or an assembly reference?) -
如果您删除
using System.Security.Cryptography.Algorithms;并尝试在您的代码中引用AesGcm类型,现在可以吗? -
还是有这个错误:
The type or namespace name 'AesGcm' could not be found (are you missing a using directive or an assembly reference?)> 我只加了using System.Security.Cryptography; -
看这张图片:i.imgur.com/YyTlkVw.png
标签: c# cryptography .net-4.8