System.DirectoryServices is not recognised in the namespace 'System'

后端 未结 9 1302
一整个雨季
一整个雨季 2021-02-05 02:23

I\'m trying to use System.DirectoryServices in a web site project and I\'m getting this error:

The type or namespace name \'DirectoryServices

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-05 02:44

    I had the same problem when I tried to convert website to web-app. It looks like vs failing to load the assembly should be related to versioning. switch to web.config and add the assembly to it as bellow. make sure the DLL version is matching your application targeted .NET version.

    
      
        
          
            
          
        
      
    
    

    for getting a public key you need to launch Developer Command Prompt for VS. Change to GAC directory related framework on above ex C:\Windows\Microsoft.NET\Framework\v4.0.30319 and call

    sn -T System.DirectoryServices.dll
    

提交回复
热议问题