2

I am trying to use UseEndPoints() extension method in another project than the main API project.

But I get an error

IApplicationBuilder doesn't have UseEndPoints in the same context

My api startup.cs

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
        ...
        app.UseRouting();
        app.UseCors();
        app.UseAuthentication();
        app.UseAuthorization();

        app.UseMapHubs();   // this is my custom middleware
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapControllers();
        });
}

In other project I want to implement the UseMapHubs() extension method

public static class ExtensionMethods
{
    public static void UseMapHubs(this IApplicationBuilder app)
    {
        app.UseEndpoints(endpoints => // this is the line that fire the error and what I understood from that error that it doesn't find the name space or library for useendpoint 
        {

        });
    }
}

My question is: which nuget package or library does UseEndPoints exist in?

2

1 Answer 1

0

you can add manualy this package to you project file.

<ItemGroup>
     <FrameworkReference Include="Microsoft.AspNetCore.App"  Version="5.0.0"/>
</ItemGroup>

 

now, you can use 'UseEndpoints' in IApplicationBuilder

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.