Copied to clipboard

Flag this post as spam?

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


  • Rob de Mercado 32 posts 148 karma points
    Mar 13, 2019 @ 10:21
    Rob de Mercado
    0

    Porting packages to V8 - New Composer & Component way

    Following the article entitled https://our.umbraco.com/documentation/Tutorials/Porting-Packages-V8/ section 'New Composer & Component way' I have changed my code accordingly, but now get a compilation error (see screen snippet).

    enter image description here

    Please advise.

  • Koen van Ras-Neve 56 posts 361 karma points c-trib
    Mar 13, 2019 @ 10:27
    Koen van Ras-Neve
    100

    Hi Rob,

    I've had a similar issue and fixed it by changing Umbraco.Core.Components to Umbraco.Core.Composing. Also, implementing the code in the documentation I figured that you also need to use Umbraco.Web.

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Mar 13, 2019 @ 10:55
    Sebastiaan Janssen
    1

    Thanks, docs updates with the correct namespace now 👍

  • Koen van Ras-Neve 56 posts 361 karma points c-trib
    Mar 13, 2019 @ 10:59
    Koen van Ras-Neve
    2

    I created a pull request for that, should I delete it (https://github.com/umbraco/UmbracoDocs/pull/1616)? Also, the docs still don't have Umbraco.Web in the usings, which makes SetContentLastChanceFinder() throw a missing error.

  • Rob de Mercado 32 posts 148 karma points
    Mar 13, 2019 @ 12:14
    Rob de Mercado
    1

    Thanks Koen that's done the trick

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Mar 13, 2019 @ 10:43
    Søren Gregersen
    1

    I would suggest not putting code in App_Code, and if you do, try to compile your website to make sure the code actually compiles :)

  • Eric Schrepel 161 posts 226 karma points
    Jul 01, 2019 @ 17:48
    Eric Schrepel
    0

    Quick question: I'm trying to get Umbraco v8 to force Tls1.2 as its default protocol and assumed that putting a component .CS file in App_Code was the right place for that, but you're saying it should go elsewhere maybe? Not well-versed in the new Components structure so am a bit lost.

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Jul 02, 2019 @ 10:34
    Sebastiaan Janssen
    0

    This will work on v8:

    using System.Net;
    using Umbraco.Core;
    using Umbraco.Core.Composing;
    
    namespace My.Website
    {
        [RuntimeLevel(MinLevel = RuntimeLevel.Run)]
        public class MyComposer : ComponentComposer<MyComponent>
        {
            //this automatically adds the component to the Components collection of the Umbraco composition
        }
    
        public class MyComponent : IComponent
        {
            // initialize: runs once when Umbraco starts
            public void Initialize()
            {
                if (ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12) == false)
                {
                    ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls12;
                }
            }
    
            // terminate: runs once when Umbraco stops
            public void Terminate()
            {
            }
        }
    }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies