t4mvc

How can you get T4 to skip transforming for custom methods?

Is there any attribute or other method of getting T4 to skip trying to transform custom methods? Where it shows a warning saying T4MVC.tt doesn't support MyController.Method because it doesn't return a supported ActionResult type? For example: On a BaseController having this method: public UrlHelper GetUrlHelper() { return new Ur...

ASP.NET MVC Expression is rendered "as is"

I have the following line: <link href="<%= Links.Content.Site_css %>" rel="stylesheet" type="text/css" /> which is rendered to <link href="Views/Shared/%3C%25=%20Links.Content.Site_css%20%25%3E" rel="stylesheet" type="text/css" /> So expression is not executed. If I remove quotes: <link href=<%= Links.Content.Site_css %> rel="styl...

T4MVC and named parameters

I'm running into an error with T4MVC and named parameters. I have a controller: public class ProductsController : Controller { public virtual ViewResult List(int page = 1) { // foo.DoSomething() } } It seems T4MVC creates an overload List() as well. The result is that calling myProductsController.List(3) correct...

How do you add a RouteValueDictionary to a T4MVC ActionLink

There seems to be no extension method to include some arbitrary route values that normally I would expect to go into the querystring. Old code: <%: Html.ActionLink(Model.ParentMessage.Category.Text, "index", null, new { category = Model.ParentMessage.CategoryID }, new { })%> I want to change it to this but it takes the category as an...

T4MVC appears to be losing code it has already generated

I'm having a problem with T4MVC losing the code it generated each time I do an SVN update. I can fix it by deleting the .generated.cs files and re-running the template. But this is proving a bit tiresome. Is there something I am missing? First a little background information ... I am using C# v4, VS2010 and ASP.NET MVC2. I use subver...

Refactoring a form in MVC2

I find myself pasting this code over and over on many views that deal with forms. Is there a simple approach to refactor the following markup from a view in MVC2? The only changing part is the route for the cancel link (LocalizedSaveButton and LocalizedCancelLink are helper methods I created). I tried extracting it to a PartialView but I...

T4MVC: Cannot use a leading .. to exit above the top directory

Hi, I'm trying to use the T4MVC project from the MVCContrib project on codeplex (v2.6.13). I'm using ASP.NET MVC 2 RTM running against .NET 4 in Visual Studio 2010. Using the Default project template that you get when creating a new MVC 2 Web Application I modified the Home ActionLink in the Master Page to: <%= Html.ActionLink("Home", ...

T4MVC Generates controller empty constructor

Why does T4MVC generate controller default constructor? Just curious. ...

T4MVC problems with MVC 2 under VS2010: cannot convert from 'method group' to 'System.Web.Mvc.ActionResult'

Just added the T4MVC templates to my project, built and then tried to use the cool new features it introduces. I tried to update RedirectToAction("NotFound", "Error"); to RedirectToAction(MVC.Error.NotFound); I get the following error at build: Argument 1: cannot convert from 'method group' to 'System.Web.Mvc.ActionResult' Also, i...

Removing T4MVC from my VS2010 solution

I'm very new to VS2010, so this is more a question about using Visual Studio 2010 than T4MVC. Anyway, I wanted to remove T4MVC from my solution, so I deleted the two files from my root directory. However, when I rebuild and debug my solution, I still see compilation warnings associated with T4MVC.tt. What step am I missing here? Th...

Namespace error when using T4MVC

Just heard about T4MVC but i can't get it to work in my sample project (ASP.NET MVC 2, Visual Studio 2008). I get the following erros when trying to build the project: Error 1 The type or namespace name 'Account' does not exist in the namespace 'Northwind.Web.MVC' (are you missing an assembly reference?) C:\Users\Bruno\Documents\My ...

T4MVC url.action in jquery /view

Hi all, this may or may not be possible (and could well be in the docs but i've just missed it). How do i structure a Url.Action() inside my view using T4MVC that will allow me to use jQuery selectors. I've been attempting the following (in my javascript) without success: function cancelHoldBooking() { var url = '<%= Url.Action(MV...

T4MVC MVC2 Views in Areas not generated

I just create an empty MVC2 project. Add an Area and a controller and a view to it. Include T4MVC files into the project and run the custom tool. Everything is generated except the ViewNames for the views in the Area. My tree structure: Areas MyArea Controllers MyTestController.cs Views MyTest MyTestView.aspx MySecondTestVie...