I am trying to debug the following T4 template file using VS2010 professional , windows 7.
But debugger doesn't highlight the Correct line in the File : "Texttemplate2.tt"
File 1: File1.tt
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ include file="Texttemplate2.tt" #>
<#
System.Diagnostics.Debugger.Launch();
int a= 10;
Write("ASS");
GetProperty("User","UserName");
#>
File : Texttemplate2.tt
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ assembly name="System.Xml" #>
<#@ import namespace="System.Xml" #>
<#@ import namespace="System.IO" #>
<#+
public void Load()
{
string doc=null;
if(doc == null)
{
string templateDirectory = Path.GetDirectoryName(Host.TemplateFile);
string absolutePath = Path.Combine(templateDirectory,"../../App_Data/EntityUI_MetaData_Appsettings.xml");
}
}
public string GetProperty(string Entity, string prop)
{
Load();
string node="none";
if (node != "0" )
{
if (node == Entity )
{
return node;
}
}
return null;
}
#>
Is anything wrong with my code or VS2010 debugger.
Revised :
I have read all the related links regarding T4 template.but my problem is different. Let me explain the question in detail.I have created the above two T4 template files. Now I want to debug my T4 template file "File1.tt" Code ( not the generated code). what I did I launched debugger with
System.Diagnostics.Debugger.Launch();
and set breakpoints in the at
int a= 10;
.pressing F5 now caused my breakpoint is to be hit.
int a= 10;
is now
highlighted with YELLOW COLOR as BACKGOUND and YELLOW ARROW as in LEFT . press F11 thereafter until you reach
GetProperty
, there you will notice that YELLOW ARROW , means current executing statement is not highlighted.
Meant, supppose Line:20 is the next executing statement , the debugger highlights line:10 in texttemplatefile2.tt