Visual stuio模板参数不返回值? [英] Visual stuio template parameters not returning values?

查看:162
本文介绍了Visual stuio模板参数不返回值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在创建Visual Studio模板时获取这些参数,但是它没有返回值,而是保持不变:

I'm trying to get these parameters while creating a visual studio template but it doesn't return a value, it just stays like this:

string rootnamespace = $rootnamespace$; // this is the output, it just stays as it was declared
string SpecificSolutionName = $SpecificSolutionName$; // this is the output, it just stays as it was declared

根据 msdn-模板参数:

SpecificSolutionName: 解决方案的名称.选中创建解决方案目录"时,SpecificSolutionName具有解决方案名称.未选中创建解决方案目录"时,SpecificSolutionName为空白.

SpecificSolutionName: The name of the solution. When "create solution directory" is checked, SpecificSolutionName has the solution name. When "create solution directory" is not checked, SpecificSolutionName is blank.

我确保已选中创建解决方案目录",但仍然没有任何价值.

And I made sure that the "create solution directory" is checked, but still it doesn't give any value.

如何获取这些值.请...?

How can I get these values. please... ?

推荐答案

我还发现$ SpecificSolutionName $被破坏了.解决方法是,解决方案的目录通常与解决方案的名称相同,因此:

I also found $SpecificSolutionName$ to be broken. As a work around it turns out the directory of the solution is usually the same as the name of the solution and thus:

  • 如果您的解决方案模板只有一个项目:解决方案和项目名称相同,因此您可以简单地使用$ projectname $代替损坏的$ SpecificSolutionName $.

  • If your solution template has only 1 project: the solution and project names are identical and thus you can simply use $projectname$ in lieu of the broken $SpecificSolutionName$.

如果您的解决方案模板具有多个项目(也称为ProjectCollection):将属性CopyParameters ="true"添加到所需的ProjectTemplateLink元素,并使用$ ext_projectname $代替损坏的$ SpecificSolutionName $.

If your solution template has multiple projects (aka ProjectCollection): add the attribute CopyParameters="true" to the desired ProjectTemplateLink element and use $ext_projectname$ in lieu of the broken $SpecificSolutionName$.

这篇关于Visual stuio模板参数不返回值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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