T4 toolbox RenderCore no suitable method to override

T4 toolbox a very good Visual Studio addin to efficiently manage T4 template. If you move to the new version you should be aware that there is a breaking change in the base Template class. In old version you render all text inside the method RenderCore()

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
protected override void RenderCore()
{
GenerateDto(
AssemblyName,
HostDirectory,
TypeName,
DtoName,
NameSpaceName,
DataContractNameSpace,
InheritLevel,
Properties,
PropertyDataList,
GenerateINotifiedPropertyChanging,
GenerateINotifiedPropertyChanged,
GenerateIEditableObject);
}

In the new version the function RenderCore is not accessible anymore from derived classes, and you should override the TransformText() function. In my DtoGenerator the above function will be modified in

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
public override string TransformText()
{
GenerateDto(
AssemblyName,
HostDirectory,
TypeName,
DtoName,
NameSpaceName,
DataContractNameSpace,
InheritLevel,
Properties,
PropertyDataList,
GenerateINotifiedPropertyChanging,
GenerateINotifiedPropertyChanged,
GenerateIEditableObject);
 
return this.GenerationEnvironment.ToString();
}

Since everything is generated into GenerateDto function, I simply changed the declaration of the function and added the return this.GenerationEnvironment.ToString(); to make everything work. If you forget to do this you get the error

Compiling transformation: ‘Microsoft.VisualStudio.TextTemplating.blablabla. RenderCore(): no suitable method found to override. alk.