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).

When I try to build a project, I get the following erros:

Error 1 The type or name of the account namespace does not exist in the namespace Northwind.Web.MVC (do you miss the assembly reference?) C: \ Users \ Bruno \ Documents \ My Dropbox \ Projetos.NET \ Northwind \ Northwind.Web.MVC \ AccountController.generated.cs 38 61 Northwind.Web.MVC

Here an error occurs:

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

I really hate magic strings, so please help me do this!

+4
source share
1 answer

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 the go :)

Alternatively, you can rename your namespace if you want (Northwind.Web. MVC )

+8
source

All Articles