Copied to clipboard

Flag this post as spam?

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


  • Torben S 3 posts 73 karma points
    Jun 25, 2016 @ 08:46
    Torben S
    0

    How to manage/use code in seperat project

    Hi,

    I´m new to umbraco, and have been looking in to "best practice", and recommendations regarding Visual Studio and version control.

    Right now it seems like the best solution for me is keep models and surfacecontrollers in a seperat project, and deploy the output the umbraco website on IIS.

    I found the .Core NuGet package for this scenario, but i´m not sure how to reference and use this .dll on the site. I guess i have to reference the .dll, but from there i´m not sure how to do.

    Any "beginner" advice would be appreciated.

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jun 25, 2016 @ 21:05
    David Brendel
    0

    Hi Torben,

    if you use the nuget packages you can just install the core package in your seperate project.

    The main website project has also the Core DLL when you install umbraco by nuget.

    During publishing VS takes care that all dlls are shipped.

    Regards David

  • Torben S 3 posts 73 karma points
    Jun 26, 2016 @ 18:51
    Torben S
    0

    Hi David,

    Thanks for the fast reply.

    Is it enough that the dlls are copied? What i dont understand is how the umbraco installation knows how to load the controllers in my copied dll, instead of the original ones.

    Are there not some way i have to tell umbraco to use the controllers namespace in my custom dll?

  • Cimplex 113 posts 576 karma points
    Jun 26, 2016 @ 19:24
    Cimplex
    1

    Hi Torben, I usually create two ASP.NET Web Application with the MVC references, in my main project I install Umbraco with nuget:

    Install-Package UmbracoCms
    

    In my other web application where I store my controllers and other classes I install the Umbraco Core package with nuget.

    Install-Package UmbracoCms.Core
    

    In my main project I add a reference to the other project and then everything will work automatically, no other changes are required.

    // Herman

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Jun 26, 2016 @ 22:14
    David Brendel
    100

    Hi Torben,

    because you inherit from the build in umbraco controller, it will automatically pick them up during start of the web application.

    There is nothing you have to manually register.

    Think it does that by reflection.

    Regards David

  • Torben S 3 posts 73 karma points
    Jul 06, 2016 @ 10:06
    Torben S
    0

    Thanks for the answers - as you all hinted, it just works!

  • 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