简体   繁体   English

在.vsix Visual Studio代码段扩展的.pkgdef中制作什么条目

[英]What entry to make in .pkgdef for a .vsix Visual Studio Snippets Extension

I have a .vsix solution in Visual Studio 2017 for deploying 4 folders of snippets. 我在Visual Studio 2017中有一个.vsix解决方案,用于部署4个片段片段。

Here is what it looks like 这是它的样子

Does each folder that has it's own xml or C# snippets need it's own .pkgdef file? 每个具有自己的xml或C#代码段的文件夹是否都需要它自己的.pkgdef文件? Or do we just need a single .pkgdef file located directly under CompanySnippets? 还是只需要一个直接位于CompanySnippets下的.pkgdef文件?

I ask because we had one .pkgdef file with the following entries 我问是因为我们有一个.pkgdef文件,其中包含以下条目

[$RootKey$\Languages\CodeExpansions\CSharp\Paths]
"CompanyCodeSnippets"="$PackageFolder$"

[$RootKey$\Languages\CodeExpansions\Xml\Paths]
"CompanyCodeSnippets"="$PackageFolder$"

But we are getting unrecognized language problems for the snippets and I think I've troubleshot it down to the .pkgdef file. 但是,对于这些代码片段,我们遇到了无法识别的语言问题,我想我已经将其问题拖到了.pkgdef文件中。

If I make a seperate .pkgdef for each folder of snippets, I will get them to show up. 如果我为每个片段文件夹分别创建一个.pkgdef,我将显示它们。

I'm confused on how to look at the value of $RootKey$, and what the $PackageFolder$ is really dowing. 我对如何查看$ RootKey $的值以及$ PackageFolder $的含义感到困惑。 Not much documentation on these values other than what MS says they are. 除了MS所说的以外,没有多少关于这些值的文档。 I was debugging VS 2017 and that should be at Registry Computer\\HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\15.0 , but that registry has no Languages\\CodeExpansion, so I'm not sure if that is part of our problem. 我正在调试VS 2017,应该在Registry Computer \\ HKEY_CURRENT_USER \\ Software \\ Microsoft \\ VisualStudio \\ 15.0处进行调试,但是该注册表没有Languages \\ CodeExpansion,所以我不确定这是否是我们问题的一部分。

And I'm also not sure if $PackageFolder$ is grabbing snippets from subfolders. 而且我也不确定$ PackageFolder $是否从子文件夹中获取摘要。

Any help is much appreciated. 任何帮助深表感谢。

Perhaps late to the party, but here's the official documentation on all the supported substitution strings in pkgdef files: https://docs.microsoft.com/en-au/visualstudio/extensibility/substitution-strings-used-in-dot-pkgdef-and-dot-pkgundef-files?view=vs-2015 . 也许聚会晚了,但这是pkgdef文件中所有受支持的替换字符串的正式文档: https ://docs.microsoft.com/zh-cn/visualstudio/extensibility/substitution-strings-used-in-dot-pkgdef -and-dot-pk-pkgundef-files?view = vs-2015

A single pkgdef should be enough, but you'll most likely want to keep the C# and XML snippets in separate folders or else the snippets manager might be confused. 一个pkgdef应该足够,但是您很可能希望将C#和XML代码段保存在单独的文件夹中,否则代码段管理器可能会感到困惑。

Here's how the corresponding part of your pkgdef should look like: 这是pkgdef对应部分的外观:

[$RootKey$\Languages\CodeExpansions\CSharp\Paths]
"CompanyCodeSnippets"="$PackageFolder$\CompanyCodeSnippets-CSharp"

[$RootKey$\Languages\CodeExpansions\Xml\Paths]
"CompanyCodeSnippets"="$PackageFolder$\CompanyCodeSnippets-Xml"

(apologies, cannot remember off the top of my head if one needs to escape the backslash characters in the paths) (很抱歉,如果需要在路径中转义反斜杠字符,我将不记得了)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM