I'm trying to setup NSB in a .NET Core Web Api project to send commands to a .NET Core Endpoint project containing handlers to receive messages. Code so far to register NSB:
public void ConfigureServices(IServiceCollection services)
{
......
......
//services.AddNServiceBus(endpointConfiguration);
var endpoint = Endpoint.Start(SetupEndpointConfiguration()).GetAwaiter().GetResult();
services.AddSingleton(endpoint);
}
According to NSB docs ( https://docs.particular.net/samples/dependency-injection/aspnetcore/ ), using built in DI of .net core ( 3.1 for me), we should be able to call .AddNServiceBus() on the services object. However, I am unable to do so since VS cannot resolve the method. I have the following libraries installed:
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using NServiceBus;
using Serilog;
What I've tried: Made an endpoint using Endpoint.Start() and registered it using addSingleton() as shown in the first code block. But not satisfied since the docs should let me use the AddNServiceBus() to register NSB within ConfigureServices().
Why is .AddNServiceBus() not resolvable, despite having NSB installed?