0

I want to create my own empty controller template using SideWaffle as described here. The process is simple: I just change template code Controller.cs.t4 inside 'CodeTemplates/MvcControllerEmpty' to test my template. I followed documention and I just move "using namespace" to class definition. But when I add new Empty Controller to web project, it does not create my template. Currently my Templates is as follow:

<#@ template language="C#" HostSpecific="True" #>
<#@ output extension="cs" #>
<#@ parameter type="System.String" name="ControllerName" #>
<#@ parameter type="System.String" name="ControllerRootName" #>
<#@ parameter type="System.String" name="Namespace" #>
<#@ parameter type="System.String" name="AreaName" #>

namespace <#= Namespace #>
{
    public class <#= ControllerName #> : Controller
    {
        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Web;
        using System.Web.Mvc;
        //
        // GET: <#= (!String.IsNullOrEmpty(AreaName)) ? ("/" + AreaName) : String.Empty    #>/<#= ControllerRootName #>/
        public ActionResult Index()
        {
             return View();
        }
     }
 }
PW Kad
  • 14,953
  • 7
  • 49
  • 82
Seyed Morteza Mousavi
  • 6,855
  • 8
  • 43
  • 69
  • There are two types of empty controllers; Empty MVC Controller and Empty Web API. Are you sure you invoked the scaffolder that you customized? I did the exact same thing when I was trying it out. I think its because in the folders the Web API ones are listed first (since the folder names start with API) and in the UI the MVC ones are listed first. Perhaps you are running into the same thing? – Sayed Ibrahim Hashimi Dec 28 '13 at 20:06
  • I am quite sure that I change just mvc empty controller. but what you mean "are you sure you invoked the scaffolder that you customized."? I add controller by right click on "controllers" folder, select add new controller and in box appears I select "Empty Mvc Controller". – Seyed Morteza Mousavi Dec 29 '13 at 03:57

1 Answers1

1

I found the solution.

I download ASP.NET and Web Tools 2013.1 for Visual Studio 2012 (Because currently I am use visual studio 2012) and install that using web platform installer. And then installed SideWaffle. After that I tried again and it works fine!

Seyed Morteza Mousavi
  • 6,855
  • 8
  • 43
  • 69