Copied to clipboard

Flag this post as spam?

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


  • Bilal Haidar 144 posts 410 karma points
    Dec 28, 2016 @ 14:45
    Bilal Haidar
    0

    Cannot reference Class Library inside Umbraco Templates

    Hello,

    I'm facing a problem with a Template View whereby I am referencing an external class library.

    In the CL, I've added references to Umbraco.Core and Newtonsoft.Json. For now I define a property editor converter in that CL.

    In the website, I added a reference to that CL, inside the Template View, I do something as:

    @using FanoeCustomLogic;
    

    For some reason, VS keeps telling me:

    CS0246  The type or namespace name 'FanoeCustomLogic' could not be found (are you missing a using directive or an assembly reference?)  
    

    I already added a reference to that DLL. I am not sure whats going on.

    Any hint or idea?

    Thanks /Bilal

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Dec 28, 2016 @ 14:49
    Damiaan
    0

    Hi Bilal,

    FanoeCustomLogic refers to a starterkit i guess.

    You should use @using Your.own.Namespace.of.the.CL

    Kind regards

  • Bilal Haidar 144 posts 410 karma points
    Dec 28, 2016 @ 15:03
    Bilal Haidar
    0

    Hi

    Fanoe is the starter kit. I've created a new CL named it FanoeCustomLogic.dll and the namespace is also the same.

    Regards Bilal

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Dec 28, 2016 @ 15:07
    Damiaan
    100

    Then it should work. I guess you are overlooking something.

    Is the namespace of the class correct? Aren't you nesting namespaces? Is the CL build and is the (correct version) of the DLL in your bin folder of the website (use IlSpy to verify)?

    Good luck
    Damiaan

  • Bilal Haidar 144 posts 410 karma points
    Dec 28, 2016 @ 17:30
    Bilal Haidar
    1

    I had to repair VS 2015, then create a new Solution Project, add Umbraco and create a new CL.

    Something wrong was stuck with VS, as it was accepting Umbraco classes without having a reference to their DLLs.

    Now it is solved.

    Thanks for your assistance Damiaan.

    /Bilal

  • Damiaan 442 posts 1302 karma points MVP 6x c-trib
    Dec 28, 2016 @ 19:37
    Damiaan
    1

    Glad it is resolved!

Please Sign in or register to post replies

Write your reply to:

Draft