错误CS0234:类型或名称空间名称'AccountManagement'在名称空间'System.DirectoryServices'中不存在(CS0234)

时间:2020-09-01 05:40:09

标签: c# .net visual-studio

第一次使用Visual Studio,我刚收到一个新项目并尝试运行它。我收到以下错误Error CS0234: The type or namespace name 'AccountManagement' does not exist in the namespace 'System.DirectoryServices' (are you missing an assembly reference?) (CS0234)

任何帮助将不胜感激, 谢谢

1 个答案:

答案 0 :(得分:-1)

根据我的研究,也许您正在使用以下类似的代码,它们需要名称空间System.DirectoryServices.AccountManagement

 PrincipalContext context = new PrincipalContext(ContextType.Domain, "Company");

和往常一样,我们有两种解决方法。

首先,按照其他人的建议,您可以安装nuget-package System.DirectoryServices.AccountManagement

enter image description here

第二,您可以像下面那样使用visual-studio intellisense:

enter image description here

相关问题