Regarding the error i am getting when migrating from UIS to CLU

Podavu Mani Shankar Reddy 0 Reputation points
2025-08-11T09:51:49.76+00:00

TreasuryBot.dialog error: Type Microsoft.CluRecognizer not registered in factory.

Getting this error when trying to migrate from LUSI to CLU

tried adding this using Microsoft.Bot.Components.Recognizers.CLURecognizer;

If anyone helps it would be really helpful for me

Azure Advisor
Azure Advisor
An Azure personalized recommendation engine that helps users follow best practices to optimize Azure deployments.
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Chen1018 9,835 Reputation points Independent Advisor
    2025-08-11T10:28:52.18+00:00

    Hi there,

    I'm Cherrelyn and I'm here to help.

    That error usually means the CLU recognizer type isn’t registered in your bot’s startup/config. Even if you’ve added using Microsoft.Bot.Components.Recognizers.CLURecognizer;, you still need to reference the right NuGet package and call the registration code like adding the recognizer to your bot’s service collection or component registration in Startup.cs. Double-check that the CLU package is installed, your namespace matches, and that the component is explicitly registered before the bot tries to use it.

    I hope this will help and If you have any question please feel free to ask.

    Warm regards,

    Cherrelyn

    0 comments No comments

  2. Rashmika Inagadapa 0 Reputation points Microsoft External Staff Moderator
    2025-08-12T07:27:58.82+00:00

    Hi Podavu Mani Shankar Reddy,

    Adding few more additional details to the answer provided by Chen1018,

    The error "TreasuryBot.dialog error: Type Microsoft.CluRecognizer not registered in factory" is a common issue encountered when migrating a Bot Framework application from LUIS to CLU. This error means the CLU recognizer type (Microsoft.CluRecognizer) is not registered in your bot and cannot find the necessary instructions to create an instance of the CLURecognizer.

    Adding the Using statement alone isn’t enough — the runtime must have the correct NuGet package installed and the component explicitly registered before your dialogs are loaded.

    Here are a series of steps to troubleshoot the issue:

    Step 1: Ensure that the correct NuGet package is installed in your project. This package contains the CLURecognizer class and its dependencies.

    dotnet add package Microsoft.Bot.Components.Recognizers.CLURecognizer

    In Visual Studio, go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution and search for the package. If it's not installed in your bot project, install it.

    For more information click here: NuGet Gallery | Microsoft.Bot.Components.Recognizers.CLURecognizer 1.0.1

     Step 2: Create the Registration Class and then register the Component in Program.cs

    Create a class that inherits from BotComponent. This class is a self-contained unit that tells the application's dependency injection container which services to add.

    File: CLURecognizerRegistration.cs

    C#

    using Microsoft.Bot.Builder;

    using Microsoft.Bot.Components.Recognizers.CLURecognizer;

    using Microsoft.Extensions.DependencyInjection;

    using Microsoft.Extensions.Configuration;

     

    public class CLURecognizerRegistration : BotComponent

    {

        public override void ConfigureServices(

            IServiceCollection services,

            IConfiguration configuration)

        {

            // Register the CLURecognizer as a singleton.

            services.AddSingleton<CLURecognizer>();

        }

    }

    File: Program.cs

    C#

    // Import the necessary namespaces

    using Microsoft.Bot.Builder;

     

    // Create the application builder

    var builder = WebApplication.CreateBuilder(args);

     

    // Register your custom BotComponent

    // tells the dependency injection container to recognize your registration class and call its ConfigureServices method.

    builder.Services.AddSingleton<BotComponent, CLURecognizerRegistration>();

     

    // ... [other service registrations and middleware configuration]

    var app = builder.Build();

    app.Run();

     Step 3: After registering the component, ensure that the application's configuration and dialog files are correctly set up for CLU.

    appsettings.json: Confirm that you have the necessary CLU configuration keys and that their values match your Azure Language Service resource.

    JSON

    {

      "CluProjectName": "YourCluProjectName",

      "CluDeploymentName": "YourCluDeploymentName",

      "CluAPIKey": "YourCluAPIKey",

      "CluAPIHostName": "https://<your-language-resource-name>.cognitiveservices.azure.com"

    }

     

    If you are using Adaptive Dialogs with dialog files, verify that the $kind property for your recognizer is correctly specified as "Microsoft.CluRecognizer".

    After publishing, confirm Microsoft.Bot.Components.Recognizers.CLURecognizer.dll is present in the output folder. Missing DLLs will also trigger this error.

    If the package is installed, registration code is added, and $kind is correct, you will correctly register the CLURecognizer with the dependency injection system, allowing your bot to instantiate the component and successfully migrate to Conversational Language Understanding.

     

    Follow the above steps to troubleshoot the issue. For any additional help or assistance do let me know. I am happy to help you with your queries.

    If the information is helpful, please click on Upvote and Accept Answer on it so that it can help other community members.

    Thank you,

    Rashmika

    0 comments No comments

  3. Podavu Mani Shankar Reddy 0 Reputation points
    2025-08-12T08:13:55.6+00:00

    CLURecognizerRegistration.cs
    this file is getting error

    services.AddSingleton<CLURecognizer>(); in this line

    using Microsoft.AspNetCore.Builder;

    using Microsoft.AspNetCore.Hosting;

    using Microsoft.Bot.Builder;

    using Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime.Extensions;

    using Microsoft.Extensions.Configuration;

    using Microsoft.Extensions.DependencyInjection;

    using Microsoft.Extensions.Hosting;

    using System;

    namespace TreasuryBot

    {

    public class Program
    
    {
    
        public static void Main(string[] args)
    
        {
    
            CreateHostBuilder(args).Build().Run();
    
            var builder = WebApplication.CreateBuilder(args);
    
            builder.Services.AddSingleton<BotComponent, CLURecognizerRegistration>();
    
            var app = builder.Build();
    
            app.Run();
    
        }
    
        public static IHostBuilder CreateHostBuilder(string[] args) =>
    
            Host.CreateDefaultBuilder(args)
    
                .ConfigureAppConfiguration((hostingContext, builder) =>
    
                {
    
                    var applicationRoot = AppDomain.CurrentDomain.BaseDirectory;
    
                    var environmentName = hostingContext.HostingEnvironment.EnvironmentName;
    
                    var settingsDirectory = "settings";
    
                    builder.AddBotRuntimeConfiguration(applicationRoot, settingsDirectory, environmentName);
    
                    builder.AddCommandLine(args);
    
                })
    
                .ConfigureWebHostDefaults(webBuilder =>
    
                {
    
                    webBuilder.UseStartup<Startup>();
    
                });
    
    }
    

    }
    this is my porgram.cs i have added as you said

    please help me with this Rashmika

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.