T4模板预处理的调试不工作 - 的Visual Studio 2010 RTM [英] T4 Preprocessed Template Debugging Not Working - Visual Studio 2010 RTM

查看:213
本文介绍了T4模板预处理的调试不工作 - 的Visual Studio 2010 RTM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图调试预处理T4模板,我不能踏进通过运行预处理模板创建的类。我能够创建类的实例,但只要我尝试步入在调试时,一个新的窗口弹出,上面写着

I am attempting to debug a preprocessed T4 template and I am not able to step into the class created by running the preprocessed template. I am able to create an instance of the class but as soon as I try to step into while debugging, a new window pops up that says

没有可用的源。没有可用于当前位置没有源代码。

No source available. There is no source code available for the current location.

我的理解是,经过预处理的模板可以调试就像一个正常的C#类,这是不正确的?有什么特别,你需要做的是能够进入由预处理模板中定义的类?

My understanding was that preprocessed templates could be debugged just like a normal c# class, is this not correct? Is there anything in particular that you need to do to be able to step into the class defined by a preprocessed template?

下面是一个非常简单的模板,并调用代码我与遇到问题:

Here is a very simple template and the calling code that I am experience the problem with:

TestPreprocessedTemplate.tt:

<#@ template language="C#" debug="true" #>
Hello <# Write("World"); #>

测试代码:

var template = new TestPreprocessedTemplate();
string test = template.TransformText();

修改 - 增加了调试=真语句每下面的建议,仍然有同样的问题。

Edit - Added the debug="true" statement per the suggestion below, still have same problem.

更新 - 我还张贴在MSDN论坛这个问题,并收到了表明一个MS员工的响应是什么我上面的确实工作描述。 ?任何人都曾经遇到这个问题。

Update - I also posted this question on the MSDN forums and received response from a MS employee that indicated yes what I described above should indeed work. Anyone else ever run into this problem?

更新 - 从MSDN论坛一些帮助,它看起来像问题是与#行该被添加到所生成的C#类指令。注释出来让我逐句通过代码的预期。 有什么办法,以防止被添加到生成的类这些指令?有了一个ASP.NET页面,您可以添加LinePragmas =false的参数,但不会出现有对任何影响T4模板。任何想法?

Update - With some help from the MSDN forums, it looks like the problem is with the #line directives that get added to the generated c# class. Commenting them out allows me to step through the code as expected. Is there any way to prevent these directives from being added to the generated class? With an ASP.NET page you can add the LinePragmas="false" parameter but that does not appear to have any effect on a T4 template. Any ideas?

推荐答案

奥列格是我检查OU的 http://www.olegsych.com/2008/09/t4-tutorial-debugging-code-generation-files/

oleg is the master I'd check ou http://www.olegsych.com/2008/09/t4-tutorial-debugging-code-generation-files/

这篇关于T4模板预处理的调试不工作 - 的Visual Studio 2010 RTM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆