IServiceCollectionConfigurator' does not contain a definition for 'UsingRabbitMq'

20 views Asked by At

Im getting this error when trying to use "UsingRabbitMq" in my configurations.

'IServiceCollectionConfigurator' does not contain a definition for 'UsingRabbitMq' and no accessible extension method 'UsingRabbitMq' accepting a first argument of type 'IServiceCollectionConfigurator' could be found (are you missing a using directive or an assembly reference?)CS1061

public void ConfigureServices(IServiceCollection services)
        {

serviceSettings = Configuration.GetSection(nameof(ServiceSettings)).Get<ServiceSettings>();

services.AddMassTransit(x =>
            {
                x.UsingRabbitMq((context, configurator) =>
                {
                    var RabbitMQSettings = Configuration.GetSection(nameof(RabbitMqSettings)).Get<RabbitMqSettings>();
                    configurator.Host(RabbitMQSettings.Host);
                    configurator.ConfigureEndpoints(context, new KebabCaseEndpointNameFormatter(serviceSettings.ServiceName, false));
                });
            });

.....

The ".UsingRabbitMq" part is the only thing giving me an error in the startup class.

Im using .NET 5.0 and my .csproj looks like this

<ItemGroup>
    <PackageReference Include="MassTransit.AspNetCore" Version="5.3.2" />
    <PackageReference Include="MassTransit.RabbitMQ" Version="5.3.2" />
    <PackageReference Include="MassTransit.Extensions.DependencyInjection" Version="5.3.2" />
    <PackageReference Include="MongoDB.Driver" Version="2.23.1" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.1" />
    <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.0.0" />
    <PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="5.0.0" />
  </ItemGroup>

These are all my imports

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MassTransit;
using MassTransit.Definition;
using MassTransit.RabbitMqTransport.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Models;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
using MongoDB.Driver;
using Shop.Catalog.Service.Entities;
using Shop.Catalog.Service.Repositories;
using Shop.Catalog.Service.Settings;
using Shop.Catalog.Service.Contracts;
using RabbitMQ;

Any ideas to what could be causing this?

I have tried different versions of the packages but always end up with the same error. I tried all kinds of imports but still doesn't work. No answers on google related to UsingRabbitMQ as far as i have searched. Help much appreciated

0

There are 0 answers