I am trying to create a package of my code in Umbraco 7. Everything works fine when I import the package to a new Umbraco project except that the new project can not find the SurfaceController in the routes table unless I specifically import the file into the Visual Studio project (which my end client won't have).
I've created an Area under my project called "Controls" and added the controller there. I've then adorned the controller with the [PluginController("Controls")]. So I have this structure:
--Root VS Project
--Area
--Controls
--Controllers
--MyController
I call this from my code like so:
@Html.Action("Index", "MyController", new { area = "Controls" }
This works absolutely fine again when running in VS with these files included as part of the project, but breaks when I then export this and import the package (with all of the other associated files) in to a new Umbraco project, saying that it can't find the route. My assumption was that adding the [PluginController("Controls")] attribute meant that upon startup the Umbraco project would find the controller and add it to the routes. Is this not the case?
SurfaceControllers in exported Packages
I am trying to create a package of my code in Umbraco 7. Everything works fine when I import the package to a new Umbraco project except that the new project can not find the SurfaceController in the routes table unless I specifically import the file into the Visual Studio project (which my end client won't have).
I've followed the instructions here: https://our.umbraco.org/documentation/reference/routing/surface-controllers
But get the same "Could not find route" error.
I've created an Area under my project called "Controls" and added the controller there. I've then adorned the controller with the
[PluginController("Controls")]
. So I have this structure:I call this from my code like so:
This works absolutely fine again when running in VS with these files included as part of the project, but breaks when I then export this and import the package (with all of the other associated files) in to a new Umbraco project, saying that it can't find the route. My assumption was that adding the [PluginController("Controls")] attribute meant that upon startup the Umbraco project would find the controller and add it to the routes. Is this not the case?
The issue was that I wasn't including the DLL of the project from which I was exporting in to the bin folder of the project to which I was importing.
is working on a reply...