项目模板 - $ classname $与$ safeitemname $ [英] Item templates - $classname$ versus $safeitemname$

查看:56
本文介绍了项目模板 - $ classname $与$ safeitemname $的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从迁移到VS2010以来,我们的一些项目模板已经坏了。

Since moving to VS2010, some of our item templates have broken.

我们有一些项目模板可以在各个子文件夹中创建多个类。  我们使用$ classname $参数为每个类添加项目名称前缀。   $ classname $不再被替换,所以我尝试使用$ safeitemname $代替。  然而,似乎$ safeitemname $根据文档没有执行 - 它被替换为添加的文件名而不是"新项目"中提供的项目名称。对话框。

We have a few item templates that create several classes in various sub-folders.  We used the $classname$ parameter to prefix each class with the item name.  $classname$ is no longer being replaced, so I tried using $safeitemname$ instead.  However it seems that $safeitemname$ does not perform according to the documentation - it is replaced with the filename that is added rather than the item name that was provided in the "new item" dialog.

例如,我们得到名为CellDataViewRequestViewRequest的类而不是CellDataViewRequest - 其中"CellData"是新项目名称,项目模板包含$ safeitemname $ ViewRequest,包含类模板的文件名为ViewRequest.cs。  同样,$ rootnamespace $ .Client.DataViews。$ safeitemname $出现为"Logic.Client.DataViews.CellDataRequest""而不是"...... CellData"正如预期的那样。

For example, we get classes called CellDataViewRequestViewRequest instead of CellDataViewRequest - where "CellData" was the new item name, the item template contains $safeitemname$ViewRequest and the file containing the class template is named ViewRequest.cs.  Likewise, $rootnamespace$.Client.DataViews.$safeitemname$ comes out as "Logic.Client.DataViews.CellDataRequest" rather than "...CellData" as expected.

任何解释?

推荐答案

您有没有找到任何解决方案?我正在创建一个模板,并希望获得

Did you ever find any solution to this? I am working on creating a template and would like to get the value that


safeitemname
safeitemname


应具有的值(根据文档)。  ;除非有人对如何解决这个问题有另一个想法。
is supposed to have (according to the documentation).  Unless someone has another idea on how to solve this.

我在使用用户在添加模板时在对话框中指定的名称生成ClassA。 我的模板通过将UserControl添加到类名的末尾来创建ASCX文件。 所以在这种情况下我将ClassAUserControl作为ASCX文件
的代码。 在ClassAUserControl中,我想引用ClassA,但是当我访问

I have ClassA being generated by the name the user specifies in the dialog when adding the template.  My template creates a ASCX file by adding UserControl to the end of the class name.  So in this case I'd have ClassAUserControl as the code for the ASCX file.  Within ClassAUserControl, I want to put a reference to ClassA, but when I access


这篇关于项目模板 - $ classname $与$ safeitemname $的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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