Failure to create a custom action - Bot Service

Gonzalez, Cameron 1 Reputation point
2021-06-29T20:00:22.72+00:00

I was following the tutorial how-to-create-custom-actions and followed the entire thing. I got as far as being able to add the custom action within Bot Framework Composer and had no errors. However, upon clicking 'Start Bot' I am encountering an error:

Error occurred building the bot

Unhandled exception. System.AggregateException: Encountered exceptions while loading bot components. (Could not load file or assembly 'CustomAction.MultiplyDialog, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.) ---> System.IO.FileNotFoundException: Could not load file or assembly 'CustomAction.MultiplyDialog, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. File name: 'CustomAction.MultiplyDialog, Culture=neutral, PublicKeyToken=null' at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly assemblyContext, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext) at System.Reflection.Assembly.Load(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext) at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName) at Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime.Component.AssemblyBotComponentEnumerator.GetComponents(String componentName)+MoveNext() at Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime.Component.BotComponentDefinition.Load(IBotComponentEnumerator pluginEnumerator, IServiceCollection services, IConfiguration configuration) at Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime.Extensions.ServiceCollectionExtensions.AddBotRuntimeComponents(IServiceCollection services, IConfiguration configuration) --- End of inner exception stack trace --- at Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime.Extensions.ServiceCollectionExtensions.AddBotRuntimeComponents(IServiceCollection services, IConfiguration configuration) at Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime.Extensions.ServiceCollectionExtensions.AddBotRuntime(IServiceCollection services, IConfiguration configuration) at Bot_Test.Startup.ConfigureServices(IServiceCollection services) in C:\Users\camgonzalez\Documents\Bot Framework Bots\Bot_Test\Bot_Test\Startup.cs:line 24 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass12_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services) at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider() at Microsoft.Extensions.Hosting.HostBuilder.Build() at Bot_Test.Program.Main(String[] args) in C:\Users\camgonzalez\Documents\Bot Framework Bots\Bot_Test\Bot_Test\Program.cs:line 13

I checked all the sdk.schema, appsettings.json, etc. files to see if the schema merge was performed successfully, and it appears that it has, especially with the fact that I can find the custom action within Bot Framework Composer. I have no build errors apart from a few warnings which I will list here:

Severity Code Description Project File Line Suppression State
Warning The type of schema applied to the document is not supported Bot_Test C:\Users\camgonzalez\Documents\Bot Framework Bots\Bot_Test\Bot_Test\schemas\sdk.schema 1
Warning Reference could not be resolved MultiplyDialog C:\Users\camgonzalez\Documents\Bot Framework Bots\Bot_Test\MultiplyDialog\MultiplyDialog.schema 10
Warning Reference could not be resolved MultiplyDialog C:\Users\camgonzalez\Documents\Bot Framework Bots\Bot_Test\MultiplyDialog\MultiplyDialog.schema 15
Warning Reference could not be resolved MultiplyDialog C:\Users\camgonzalez\Documents\Bot Framework Bots\Bot_Test\MultiplyDialog\MultiplyDialog.schema 20
Warning NU1701 Package 'Microsoft.Azure.KeyVault.Core 1.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project. MultiplyDialog C:\Users\camgonzalez\Documents\Bot Framework Bots\Bot_Test\MultiplyDialog\MultiplyDialog.csproj 1
Warning NU1701 Package 'Microsoft.Azure.KeyVault.Core 1.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project. Bot_Test C:\Users\camgonzalez\Documents\Bot Framework Bots\Bot_Test\Bot_Test\Bot_Test.csproj 1

Is there anything that I could have missed that would lead to this error?

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
807 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Dean Goddette 1 Reputation point
    2021-07-20T00:17:08.633+00:00

    Same error/problem. Following for potential solution.

    0 comments No comments

  2. Moshe Levi 11 Reputation points
    2021-08-05T13:56:48.29+00:00

    Same for me. any solution?

    0 comments No comments

  3. Moshe Levi 11 Reputation points
    2021-08-05T14:19:32.737+00:00

    Ok, I just find that i forgot to add reference from the custom project to the bot project. Now it's work fine.

    0 comments No comments

  4. Collins, Benjamin 1 Reputation point
    2021-08-25T21:55:45.693+00:00

    To add to @Moshe Levi 's response, I found that this error occurs when the Bot Project does not have a project reference for the custom action. You will need to right-click the bot project and go to add -> project reference, and select the custom action. After this, my project's errors were fixed.