Copied to clipboard

Flag this post as spam?

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


  • René Andersen 238 posts 684 karma points
    Feb 19, 2015 @ 15:08
    René Andersen
    0

    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é

  • Sören Deger 733 posts 2844 karma points c-trib
    Feb 19, 2015 @ 15:14
    Sören Deger
    0

    Hi René,

    are you perhaps in debug mode? If so, then click on stop and check if it works now.

     

    Best,

    Sören

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Feb 19, 2015 @ 15:15
    Jan Skovgaard
    0

    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

  • René Andersen 238 posts 684 karma points
    Feb 19, 2015 @ 15:28
    René Andersen
    0

    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é

     

     

  • Sören Deger 733 posts 2844 karma points c-trib
    Feb 19, 2015 @ 16:44
    Sören Deger
    1

    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

  • René Andersen 238 posts 684 karma points
    Feb 19, 2015 @ 16:59
    René Andersen
    0

    Hi Sören

    Could it be "Web API Controller Class (v2.1) or (v1)?

    // René

  • Sören Deger 733 posts 2844 karma points c-trib
    Feb 19, 2015 @ 17:08
    Sören Deger
    1

    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

  • René Andersen 238 posts 684 karma points
    Feb 19, 2015 @ 18:54
    René Andersen
    0

    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:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;

    namespace Refica.Controllers
    {
    public class Class1
    {
    }
    }

    Would that be the correct one?

    // René

  • Sören Deger 733 posts 2844 karma points c-trib
    Feb 19, 2015 @ 19:25
    Sören Deger
    101

    Hi René,

    yes :-) And now you must inherit your class from Umbraco.Web.Mvc.SurfaceController like this:

    public class Class1 : SurfaceController

    This is your first SurfaceController.

     

    Best,

    Sören

  • René Andersen 238 posts 684 karma points
    Feb 19, 2015 @ 19:29
    René Andersen
    0

    Hi Sören

    That's perfect. Thanks!

    // René

Please Sign in or register to post replies

Write your reply to:

Draft