2015-09-28 67 views
5

這曾經在 C#源文件在Visual Studio 2013上打字CR時顯示自定義的代碼片段:自定義代碼段之前沒有表現出先「使用」的聲明

<?xml version="1.0" encoding="utf-8" ?> 
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> 
    <CodeSnippet Format="1.0.0"> 
     <Header> 
      <Title>Insert a Copyright notice</Title> 
      <Shortcut>CR</Shortcut> 
      <Description>Code snippet for the Copyright notice comment</Description> 
      <Author>Pierre Arnaud</Author> 
      <SnippetTypes> 
       <SnippetType>Expansion</SnippetType> 
      </SnippetTypes> 
     </Header> 
     <Snippet> 
      <Code Language="csharp"> 
       <![CDATA[// Copyright © 2015, EPSITEC SA, CH-1400 Yverdon-les-Bains, Switzerland$end$]]> 
      </Code> 
     </Snippet> 
    </CodeSnippet> 
</CodeSnippets> 

在Visual Studio 2015年如果我將光標放在第一個using語句之前,代碼段CR不會顯示在 建議中。 顯示的唯一建議是兩個Visual Studio提供的 externusing片段。

任何想法,如果我不得不更新此代碼段的XML,爲此再次工作 ?

編輯:我在Microsoft Connect上打開了一個問題。

+0

所以我不是唯一一個遇到這個問題,並解釋了爲什麼我的開發者沒有遵循實踐。 – Sanj

回答

0

我發現的一個解決方法是將光標移動到代碼文件的頂部,然後按Ctrl + K,Ctrl + S(帶有片段快捷方式的環繞聲)。這帶來了代碼片斷,包括我在本地的版權。這可以選擇。不是一個很好的解決方案,但它的工作,直到有一個修復。