views:

27

answers:

1

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 Dropbox\Projetos.NET\Northwind\Northwind.Web.MVC\AccountController.generated.cs 38 61 Northwind.Web.MVC

This is where the error occurs:

[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public AccountController Actions { get { return MVC.Account; } }

I really hate magic strings, so please help me to make it work!

+1  A: 

Looks like a namespace conflict between T4MVC and your code. Go to T4MVC.settings.t4 and find this code:

// The prefix used for things like MVC.Dinners.Name and MVC.Dinners.Delete(Model.DinnerID)
const string HelpersPrefix = "MVC";

Just change "MVC" to something else and you'll be on your way :)

Alternatively, you could rename your namespace if you prefer (Northwind.Web.MVC)

David Ebbo
Thanks a lot David!
BrunoSalvino