I am attempting to call Kentico Kontent using their DeliveryClient
in a Kentico Portal project that doesn't have dependency injection. This project would like to migrate to Kontent but would like a new feature in the extisting project to be implemented with Kontent before the transition.
After installing the Kontent Delivery SDK, here's my code
var clientTest = DeliveryClientBuilder.WithProjectId("MyProjectId").Build();
I get a runtime error
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.DependencyInjection, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.'
Obviously, this project doesn't have dependency injection and I hear setting it up in a portal project is difficult if not impossible. So I decide to new up my own delivery client as outlined in Kentico's blog post
var test = new DeliveryClient(options);
But DeliveryClient
is marked internal: 'DeliveryClient' is inaccessible due to its protection level
How do I proceed?
Details
The actual issue was much dumber. I had installed the Kontent Delivery Client nuget sdk in another project and only referenced it in this one. Installing it for this project solved the problem. I am able to call the builder without any errors now.