locked
Type or namespace 'AccountManagement' does not exist in the namespace 'System.DirectoryServices' RRS feed

  • Question

  • User-561514082 posted

    I have the following namespace defined in my asp.net c# (VS 2010) app but still get the above error. What am I doing wrong?

    using System.DirectoryServices;
    using System.DirectoryServices.AccountManagement;


     

    Wednesday, July 11, 2012 3:08 PM

All replies

  • User1020195037 posted

    Did you also add a reference to these libraries in your project? Right click on your project and go to the Property Pages option. Under the References option you can Add both of these libraries.

    Wednesday, July 11, 2012 3:16 PM
  • User-101068015 posted

    Hi

    In Visual Studio click on References->Add References and choose DirectoryServices from the .Net list

    Thursday, July 12, 2012 11:34 PM
  • User-561514082 posted

    Hi

    In Visual Studio click on References->Add References and choose DirectoryServices from the .Net list

    It is already added.

    Friday, July 13, 2012 8:36 AM
  • User-1780195390 posted

    I am getting this error in VS2012. Did you ever find a way to resolve it?

    Tuesday, July 9, 2013 11:16 AM
  • User-1225287840 posted

    You might be using lower version of .NET Framework.

    System.DirectoryServices Namespace applies to .NET 1.1 and above

    BUT

    System.DirectoryServices.AccountManagement applies to .NET 4.0 and above

    Tuesday, July 9, 2013 12:00 PM
  • User2103134756 posted

    I'm having the same problem. I can get System.DirectoryServices.AccountManagement in a Web Page Project but the a Web Page that I'm working on doesn't recognize it even though I have the same reference and I'm getting the using System.DirectoryServices.ActiveDirectory to work. There is no intellisense on AccountManagement. Can you bring it into a web page? I'm writing a system that tracks Acceptable Use Policies that kids sign up for to get an ID on the network. So, right now, I'm just querrying AD to get each student's information once they've been added and placing in a table. But I'd like to have a page that resets all student passwords to our default so when the kids come back in August, they don't have to remember or have a campus tech reset they're password. We're using a VB script that does that right now but you have to go in and change the user group each time you run it. It would be nice just to use a dropdown list for each group or a "Reset All" option and just press a button.

    Thursday, June 19, 2014 10:50 PM
  • User-1300026754 posted

    I have the following namespace defined in my asp.net c# (VS 2010) app but still get the above error. What am I doing wrong?

    using System.DirectoryServices;
    using System.DirectoryServices.AccountManagement;


     

    I had the same issue - even though it was working previously. The solution for me, was to make check the properties of the Reference(System.DirectoryServices.AccountManagement) and make sure CopyLocal property was true

    Monday, August 4, 2014 4:52 AM
  • User-2097060974 posted

    You may also need to include, in addition to adding the DLL references and "using" statements, above, this code in your web.config:

    <compilation debug="true">
         <assemblies>
              <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
         </assemblies>
    </compilation>

    Thursday, November 6, 2014 7:34 PM
  • User-561514082 posted

    Right click on "Reference" and select "Add Reference"

    In the left pane; select "Browse" and search for "System.DirectoryServices.AccountManagement.dll" in your coomputer

    If found, select and the issue should be resolved.

    Friday, June 23, 2017 5:00 PM
  • User2103134756 posted

    The using directive did it. Since I usually use the Web Page option in 2010, I'm unfamiliar with the Web Project solution. Thanks.

    Thursday, February 15, 2018 4:25 AM