Possible to have Visual Studio TODO comments in aspx/ascx files appear in task list?

感情迁移 提交于 2019-12-03 16:52:23

问题


We develop asp.net webforms using visual studio 2008. For multilingual support, we translate all our text. However, when designing, we usually just enter the english text and come back to translation later (it interrupts flow of work otherwise).

I've added a "ToTranslate" tag in the options. Adding //ToTranslate: something in C# code correctly adds the entry to the Task List. I haven't however figured out how to do the same for aspx and ascx files (where most of our user text lives).

Inserting <%-- //ToTranslate: something --%> or <%-- ToTranslate: something --%> doesn't work.

Any ideas?


回答1:


It seems to me that it works fine if you put the delimiters <% and %> on a line by themselves. What I did was this: go to Tools menu and click on Options, then under Environment -> Task List add a new ToTranslate token. Click OK to accept the change. Back on the ASPX page I added the comments on a line by themselves and the code delimiters on lines by themselves.




回答2:


FYI if you want to do this in a .Net MVC3 razor cshtml file the syntax this:

@{
//TODO: Move this inline <style> css to a file
}

Take note: that you need to put the trailing } bracket on a new line as otherwise it will be included in the // comment. You could do it using /**/ like below and keep it all on one line but it's more typing, and a bit harder to read. My take is, if it annoys you the comment takes up 3 lines in your file, all the more motivation to fix the issue and remove it completely :)

@{/*TODO: Move this inline <style> css to a file*/}



回答3:


You do not need the <% %> on lines by themselves. This example shows what works and what does not:

<%//ToTranslate will work%>
<%/*ToTranslate will work*/%>
<!--ToTranslate won't work-->
<!--
ToTranslate won't work
-->

It may be due to the fact that what's differentiating between an HTML comment and some form of aspx comment is getting messed up by the -- because that's part of an html comment?



来源:https://stackoverflow.com/questions/923333/possible-to-have-visual-studio-todo-comments-in-aspx-ascx-files-appear-in-task-l

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!