[英]What's wrong with this C# CodeSnippet?
I've made snippets before but I must be overlooking something really simple; 我之前已经做过摘要,但是我必须忽略一些非常简单的内容; I cannot figure out where the error is in this snippet... 我无法弄清楚此代码段中的错误...
<CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>Throw NotImplementedException()</Title>
<Author>olaffuB</Author>
<Shortcut>nie</Shortcut>
<Description>Quickly add a new NotImplementedException() to code.</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>TODO</ID>
<Default></Default>
</Literal>
</Declarations>
<Code Language="C#">
<![CDATA[throw new NotImplementedException("$TODO$"); // TODO: $TODO$]]>
</Code>
</Snippet>
</CodeSnippet>
Basically, when I got to import the snippet, it says that it is "invalid". 基本上,当我要导入代码段时,它说这是“无效的”。 The file name is "nie.snippet". 文件名是“ nie.snippet”。 Thanks! 谢谢!
The <CodeSnippet>
tag isn't closed. <CodeSnippet>
标记未关闭。 Append </CodeSnippet>
to the file. 将</CodeSnippet>
附加到文件。
The author tag is not allowed as it seems to me: 在我看来,作者标签是不允许的:
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippet Format="1.0.0">
<Header>
<Title>class</Title>
<Shortcut>class</Shortcut>
<Description>Expansion snippet for class</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal default="true">
<ID>name</ID>
<ToolTip>Class name</ToolTip>
<Default>MyClass</Default>
</Literal>
</Declarations>
<Code Language="csharp" Format="CData">
<![CDATA[class $name$
{
$selected$$end$
}]]>
</Code>
</Snippet>
</CodeSnippet>
See here: http://msdn.microsoft.com/en-us/library/ms379562%28VS.80%29.aspx 看到这里: http : //msdn.microsoft.com/zh-cn/library/ms379562%28VS.80%29.aspx
Thanks for the help everyone. 感谢大家的帮助。 The missing end tag was my fault from copying onto the Stack. 丢失的结束标签是我复制到堆栈上的错误。 I took out the author tag and added the xml... tag to the top. 我取出了author标签,并在顶部添加了xml ...标签。 Also, I had "C#" where "CSharp" should have been. 另外,我在“ CSharp”应有的地方有“ C#”。 Here is a final working version of the snippet! 这是该代码段的最终工作版本!
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>Lemme Throw NotImplementedException()</Title>
<Shortcut>nie</Shortcut>
<Description>Allows an extreme coder to quickly add a new NotImplementedException to their code.</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>TODO</ID>
<Default>###</Default>
</Literal>
</Declarations>
<Code Language="CSharp" >
<![CDATA[throw new NotImplementedException("$TODO$"); // TODO: $TODO$]]>
</Code>
</Snippet>
</CodeSnippet>
It doesn't look like you have closed the 看来您已经关闭了
<CodeSnippet>
Tag. 标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.