问题描述
我正在尝试使用VS2010 Professional Windows 7调试以下T4模板文件.
但是调试器不会在File中突出显示正确的行:"Texttemplate2.tt"
文件1:File1.tt
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");
#>
文件:Texttemplate2.tt
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;
}
#>
我的代码或VS2010调试器有什么问题.
修订:
我已经阅读了有关T4模板的所有相关链接.但是我的问题有所不同.让我详细解释这个问题.我已经创建了以上两个T4模板文件.现在,我想调试我的T4模板文件"File1.tt"代码(而不是生成的代码).我使用
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();
启动调试器并在
int a= 10;
处设置断点的原因.现在按F5导致命中了我的断点.
.pressing F5 now caused my breakpoint is to be hit.
int a= 10;
现在以突出显示为黄色,作为BACKGOUND,而黄色箭头则为如左所示.此后按F11直到到达
is now highlighted with YELLOW COLOR as BACKGOUND and YELLOW ARROW as in LEFT . press F11 thereafter until you reach
GetProperty
,您将注意到YELLOW ARROW,表示当前正在执行的语句未突出显示.
意思是,假设Line:20是下一个正在执行的语句,调试器在texttemplatefile2.tt
, 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
推荐答案
这篇关于T4模板调试器显示错误的行,同时包含多个TT文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!