In this video, Tim is just adding a controller in the controllers folder without any problems. Am I the only one where the “add controller” is greyed out in Visual Studio 2013?
Hmm, coming to think of it - have you right clicked the "controllers" folder and chosen to "include" it in your project? If not then try doing it and see if that works?
Surface controller / add controller VS 2013
Hi,
I have installed Umbraco with NuGet following this guide:
https://our.umbraco.org/documentation/installation/install-umbraco-with-nuget
I am now following UmbracoTV videos about surface controllers and I am stuck with this video:
http://umbraco.tv/videos/developer/fundamentals/surface-controllers/the-surface-controller/
In this video, Tim is just adding a controller in the controllers folder without any problems. Am I the only one where the “add controller” is greyed out in Visual Studio 2013?
// René
Hi René,
are you perhaps in debug mode? If so, then click on stop and check if it works now.
Best,
Sören
Hi René
Hmm, coming to think of it - have you right clicked the "controllers" folder and chosen to "include" it in your project? If not then try doing it and see if that works?
/Jan
Hi
Sören - I am not in debug mode, so thats is not the problem.
Jan - The folder is included in the project.
Maybe it is done in a different way in VS 2013? Should i use "add new item" which gives me a lot of different choices?
// René
Hi René,
a surface controller is a class. If you can use "add new item" you can do this and choose "class".
Best,
Sören
Hi Sören
Could it be "Web API Controller Class (v2.1) or (v1)?
// René
Hi René,
can you choose "MVC 4-Controllerclass" or a simple "Class". It should be possible to choose a simple "Class" and use this.
Best,
Sören
Hi Sören
I can choose:
Visual C# -----> Code -----> Class (An empty class declaration).
It creates a file like this "file.cs" with this default code:
Would that be the correct one?
// René
Hi René,
yes :-) And now you must inherit your class from Umbraco.Web.Mvc.SurfaceController like this:
This is your first SurfaceController.
Best,
Sören
Hi Sören
That's perfect. Thanks!
// René
is working on a reply...