0
ApplicationUser BuildUser(UserManager<ApplicationUser> userManager

What is the reference DLL we need to add for this UserManager class?

2 Answers 2

0

In Sitecore, the UserManager class is part of the Sitecore.Security.Accounts namespace. To use it, you typically need to reference the Sitecore.Kernel assembly in your project. The DLL file you need is usually named Sitecore.Kernel.dll.

And if you are working on extending functionality make sure to add the Sitecore.Owin.Authentication DLL in your project.

As per your comments, make sure that you are referring to the following DLLs in your project to make the code working.

using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;

Make sure to check the specific version of Sitecore you're working with, as the DLL version might vary.

Ensure that the DLLs are included in your project references, and you should be able to use the UserManager class for managing users in Sitecore.

Hope this helps.

6
  • Hi @Sumit, We already having the reference to this Sitecore.Kernel.dll. But still it is not showing in the suggestions.
    – Astle
    Commented Dec 13, 2023 at 13:21
  • What Sitecore version you are using? Commented Dec 13, 2023 at 13:22
  • It is Sitecore 10.2
    – Astle
    Commented Dec 13, 2023 at 13:23
  • I just trying to use the Code reference from here bala.one/sitecore-external-user-builder-azure-active-directory
    – Astle
    Commented Dec 13, 2023 at 13:24
  • I updated my answer. Commented Dec 13, 2023 at 13:28
1

The UserManager<ApplicationUser> class is part of the Microsoft ASP.NET Identity framework, and in the context of Sitecore, the ApplicationUser class is typically associated with Sitecore's Owin Authentication.

To use the UserManager<ApplicationUser> class, you should include the following reference DLLs in your project:

<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net48" />
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net48" />

Additionally, the ApplicationUser class is defined in the Sitecore.Owin.Authentication.Identity namespace, which is part of the Sitecore.Owin.Authentication package. Ensure you have the correct version installed, for example:

<package id="Sitecore.Owin.Authentication" version="10.3.0" targetFramework="net48" />

When installing the Sitecore.Owin.Authentication package, the installation process may automatically include the required dependencies. If you choose to install with the "Lowest dependency" behaviour, it should pull in Microsoft.AspNet.Identity.Owin and Microsoft.AspNet.Identity.

Alternatively, if you choose to ignore dependencies, you can manually install the specified versions of Microsoft.AspNet.Identity.Core and Microsoft.AspNet.Identity.Owin.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.