如何传递自定义参数值 [英] How to pass custom parameter a value

查看:61
本文介绍了如何传递自定义参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个项目模板,其位于: 

> C:\..\..\Documents\Visual Studio 2017 \Templates\ItemTemplates



在我的代码中,我正在使用`AddFromTemplate( )`加载项模板的方法。项模板有一个`$ CustomParameter $`,但我不想传递`vstemplate`文件中的值。我想从我的代码中传递一个值。



我正在尝试使用`replacementsDictionary.Add(" $ CustomParameter $"," WhatIwant") `但这不起作用,因为它不在我的解决方案上。但如果我使用它:



  &NBSP; < CustomParameters>  

  &NBSP; &NBSP; &NBSP; < CustomParameter Name =" $ CustomParameter $"值="" />  

  &NBSP; < / CustomParameters> 



 

 在位于上面文件夹中的vstemplate上运行良好,但我可以通过我想要的价值。



有任何建议吗?



来源: 

https://msdn.microsoft.com/en-us/library/ms185301.aspx; 

https://msdn.microsoft.com/en-us/library/0c672h41 .aspx

I developed an item template whos's located in: 
> C:\..\..\Documents\Visual Studio 2017\Templates\ItemTemplates

On my code i'm using `AddFromTemplate()` method to load my item template. The item template has a `$CustomParameter$` but i dont want to pass the value in the `vstemplate` file. I want to pass a value from my code.

I'm trying to use `replacementsDictionary.Add("$CustomParameter$", "WhatIwant")` but this not working because the item it's not on my solution. But if i use this:

    <CustomParameters>  
        <CustomParameter Name="$CustomParameter$" Value=""/>  
    </CustomParameters> 

 
 on the vstemplate located in the folder above it works well but i can pass the value who i want.

Any suggestion?

Source: 
https://msdn.microsoft.com/en-us/library/ms185301.aspx; 
https://msdn.microsoft.com/en-us/library/0c672h41.aspx

推荐答案

您好FavJ,

Hi FavJ,

感谢您在此发帖。

由于您的问题与Visual Studio Integrate更相关,我将把它移到Visual Studio Integrate论坛以获得合适的支持。

Since your question is more related to Visual Studio Integrate, I will move it to Visual Studio Integrate forum for suitable support.

https://social.msdn.microsoft.com/Forums/en-US/home?forum=vsx&filter=alltypes& sort = lastpostdesc

Visual C#论坛讨论并询问有关C#编程语言,IDE,库,示例和工具的问题。

The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

要st问候,

Wendy


这篇关于如何传递自定义参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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