How to change the a default code snippet in Visual Studio 2017?

末鹿安然 提交于 2021-01-27 15:28:20

问题


Given this code snippet, how can I change the default code provided in this snippet, in Visual Studio 2017?


回答1:


Visual Studio 2010 -> Tools -> Code Snippet Manager

Change if needed the programming language and look ah the path of the snippet files. Close and create in VS17 a new xml file for a new snippet file. Save this as a Codesnippetfile with "Save File as" . Go to the Folder of the existing snippetfiles and copy the needed part.

   <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
                <Title>  </Title>
                <Description>  </Description>
                <Author>  </Author>
                <Shortcut>  </Shortcut>
                <SnippetTypes>
                        <SnippetType>   </SnippetType>
                </SnippetTypes>
        </Header>
        <Snippet>
            <Code Language="   ">

            </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

Fill the rest and save the codesnippet file. Go back to the Code Snippet Manager and import your new custom file snippet file. Otherwise you can edit a existing snippet file and change on this way the automatic insertet code.

For detailed instructions. https://www.telerik.com/blogs/visual-studio-tip-creating-your-own-code-snippets



来源:https://stackoverflow.com/questions/48573878/how-to-change-the-a-default-code-snippet-in-visual-studio-2017

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!