Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a large project which contains a stack of shared code across many sites. I've now moved this code from each site into a shared MVC project.
Whilst i've found it trivial to move all of my Views, CSS, scripts and models into this shared project, moving Controllers seems far from trivial.
Does anyone know how to move UmbracoApiControllers and SurfaceControllers into a seperate "shared" project. Containing nothing more than the core Umbraco dlls? I'm thinking there's issues with routing and registering that requires extra code.
Thanks in advance
All you need for an UmbracoApiController is a reference to Umbraco.Web so in theory that's all you need to do this and you'd just have a post build event to copy your project dll to the Umbraco project using it.
But, I imagine you may be performing logic either in the controller, or in some helper class called by the controller? In which case you may need other references.
As for routing then you probably don't need to set up any routes but I'm not sure what your controller does.
Can you give more info on the controller (maybe post some code) and outline what the issues are, or what errors you are getting?
In case anyone else comes across this, my issue was pretty basic, bu tripped me up for a bit - I hadn't set my API Project as a dependency in my project which has a reference to UmbracoCMS.
Once I did that, routing worked as expected. So our configuration is as follows:
API project references:
Web project references:
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted