.net.net-coredependency-injectiondapr

'IServiceCollection' does not contain a definition for 'AddDaprClient'


I'm following documentation below to inject the Dapr client into my .NET Core API

https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-client/

I have installed the NuGet package Dapr.Client 1.15.3 correctly. However, I'm getting the following compilation error when I'm trying to run my application:

'IServiceCollection' does not contain a definition for 'AddDaprClient' and no accessible extension method 'AddDaprClient' accepting a first argument of type 'IServiceCollection' could be found.......


Solution

  • It seems the issue is not having Dapr.AspNetCore installed. It is working after installing this package.