Issue with the package System.DirectoryServices.AccountManagement

Greetings everyone,

After days of trying to fix the issue I am struggling with, I decided that perhaps I need a fresh perspective from another individual. I want to to invoke c# code which requires a specific package.I tried to download the microsoft package System.DirectoryServices.AccountManagement from “Manage Packages” but this is the outcome:
Problem2
When I hover over the dependency, it says “Requested = 5.0.0, not resolved”.
I uninstalled the studio, upgraded the version and it was all the same.
Also I tried it with all the versions of the package.

I tried also to uninstall the package and download it from the nuget package site and add it manually to the other packages but unfortunately it didn’t work as well.

Also what I tried was opening the main .xaml file with notepad++ and adding

  <AssemblyReference>System.DirectoryServices</AssemblyReference>
  <AssemblyReference>System.DirectoryServices.AccountManagement</AssemblyReference>

which added the namespace in the imports panel,

Problem3
Unfortunately, it only removed the validation errors
but when I tried to compile this is the outcome:


I use the latest version of the .NET framework and my last resort was using an older .NET version but the result was the same.
If anyone has got any recommendations, I will be really grateful :slight_smile:.

Hi @svilen.ivanov

I hope this resolves your problem!!!
Cheers!!

Hello @Rakesh_Sampath !
Thank you for your response.
Unfortunately I have checked most of the similar issues concerning my problem and I’ve tried these methods but still no success :frowning: . The issue is I already have the namespace imported and is giving me no validation errors but when I run the program it throws the exception that I’ve put a screenshot of :confused:

Have you tried import namespaces in your code?

I tried to use it that way:


but it’s giving me a validation error.

Perhaps there is a way to resolve the issue within the code? :thinking: