I've recently upgraded the Sitecore 8.2 solution to Sitecore 9.1 update 1 which works fine.

But I also have to convert the existing site to SXA site. So, I started by adding the fresh SXA site but when I looked into the "MetaData" partial design in the experience editor, it was throwing the dependency injection error - "Could not create Metadata controller"

When looked deeper, I've realized the existing project uses "Castle Windsor" as dependency injection and does below

                <processor patch:instead="*[@type='Sitecore.Mvc.Pipelines.Loader.InitializeControllerFactory, Sitecore.Mvc']" type="Client.Digital.Foundation.DependencyInjection.Processor.InitialiseIocControllerFactory, Client.Digital.Foundation.DependencyInjection" />

which was replacing the - InitializeControllerFactory.

I've tried patch:after or before so that we can have both, but which ever pipeline comes last, that's dependency injection works fine.

I've also tried to Register the SXA dependencies in the castle windsor but no luck

Have someone faced this type of issue before?

I think we can have more than one dependency injection framework. Thanks

  • 2
    While it is possible to use multiple dependency injection frameworks, you really shouldn't.. Get rid of all the Castle Windsor stuff from your solution and the Sitecore OOTB stuff should do just fine for your needs.
    – Mark Cassidy
    Jun 13 '19 at 6:26
  • @MarkCassidy that's my last option as it require more work but I was thinking if Glass Mapper can use Castle Windsor along with Sitecore, is that what we can also do?
    – Meenakshi
    Jun 13 '19 at 6:30
  • 2
    No, I disagree. Blanket removing Castle Windsor will be less work, surely.
    – Mark Cassidy
    Jun 13 '19 at 6:33
  • 2
    Had the same issue, using ootb Sitecore dependency injection is the way to go.
    – Joost
    Jun 13 '19 at 7:02
  • There is just one way - get rid of Castle Windsor and go just with .Net Core DI container which is used in the Sitecore (as mentioned above). It will give you everything you need. What is more, I would consider getting rid of Glass Mapper too. I don't see the reasons to use it nowadays with SXA. Jun 13 '19 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.