Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IEndpointRouteBuilder interface not found

I have

NuGet Microsoft.AspNetCore.Http.Abstractions
NuGet Microsoft.AspNetCore.Routing

and use the namespaces

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;

I wanted to build something like this but it does not seem to know IEndpointConventionBuilder nor IEndpointRouteBuilder and refuses to compile.

public static class EndpointRouteBuilderExtensions
{
    public static IEndpointConventionBuilder MapServiceEndpoints(this IEndpointRouteBuilder endpoints)
    {

       //some code
    }
}

What am I missing...?

like image 570
Walter Verhoeven Avatar asked Dec 10 '22 01:12

Walter Verhoeven


1 Answers

If you're creating an ASP.NET Core library, then you need to include the FrameworkReference in the project file as follows:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

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

</Project>
like image 66
Xpleria Avatar answered Jan 25 '23 07:01

Xpleria