Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Dec 28, 2017 @ 14:37
    Jeroen Breuer
    2

    Using LightInject on Umbraco Cloud

    Hello,

    I've started a new Umbraco Cloud project and I thought it would be a nice idea to use LightInject for my IOC.

    After installing the latest version through NuGet I got the following error:

    umbraco Method not found: 'System.__Canon LightInject.IServiceFactory.GetInstance()'.
    

    This is because Umbraco Deploy uses an older version of LightInject. This version is not installed through NuGet so I didn't notice this before.

    After reverting my changes I added a reference to the LightInject dll files in the bin folder. This is not best practise, but since Umbraco Cloud has the bin folder in Github it's working. I also added LightInject.Mvc.dll v1.1.0 and LightInject.WebApi.dll v1.1.0 to the bin folder because I need those too. Now everything is working again and I can use LightInject with Umbraco Cloud.

    I'm not sure if this is the best way to use LightInject with Umbraco Cloud and what happens if Umbraco Deploy decides to use a newer version. Any feedback is welcome!

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Dec 28, 2017 @ 15:18
    Jeroen Breuer
    100

    Started a topic, but the discussion continued on Twitter ;-).

    Here is the thread: https://twitter.com/j_breuer/status/946390791840288770

    Jeroen

  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Dec 29, 2017 @ 07:57
    Sebastiaan Janssen
    0

    Have you tried using the latest version and adding an assembly redirect to the web.config?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Dec 29, 2017 @ 08:27
    Jeroen Breuer
    0

    No I haven't tried that. Not sure if it would work. Umbraco Deploy uses LightInject 4.1.5 and LightInject.Web 1.1.0. The latest versions are LightInject 5.1.1 and LightInject.Web 2.0.0. Since these are major version changes it will probably have some breaking changes.

    For now I'll just use the same version that Umbraco Deploy uses. That didn't cause any other issues yet.

    Jeroen

  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Dec 29, 2017 @ 09:22
    Sebastiaan Janssen
    0

    Okidoki.

    Well, LightInject doesn't make great release notes, so there's currently no way of knowing. We'll have to see.

    In any case, if we decide to upgrade our version, the automatic upgrader on Cloud should handle the version difference with yours automatically.

Please Sign in or register to post replies

Write your reply to:

Draft