Reputation: 6963
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();
}
}
}
Upvotes: 0
Views: 726
Reputation: 6963
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!
Upvotes: 1