John Livermore
John Livermore

Reputation: 31313

Removing compiler warnings generated from T4 MVC code generation

I have an issue with some compiler warnings I am getting when using T4 MVC (along with MVC3 RC2).

Say you have the following classes….

public partial class ParentController { }

public partial class ChildController : ParentController { }

T4MVC will generate something like…

public partial class ParentController
{
        [GeneratedCode("T4MVC", "2.0")]
        public readonly string Name = "Parent"; 
}
public partial class ChildController
{
        [GeneratedCode("T4MVC", "2.0")]
        public readonly string Name = "Child"; 
}

Which causes a compiler warning to occur suggesting the use of the ‘new’ keyword on the Name property in the derived class.

Is there something that can be done (short of turning the warning off completely) to get around this issue?

Upvotes: 0

Views: 225

Answers (1)

Rich Turner
Rich Turner

Reputation: 10984

You could always drag the T4 templates into your own project and customize them to your needs.

Upvotes: 1

Related Questions