2009-11-04 24 views

回答

4

如果我理解正確,您想在每個源文件的頂部留言,詳細說明您的許可模式?
如果是這樣,請嘗試Visual Studio templates

2

雖然可以製作一個帶有Visual Assist X的小腳本。它不會自動執行,但您只需在頁面頂部輸入lic即可輸出許可信息。

+0

假設許可證是樣板文本(或只有簡單的佔位符),您也可以使用Visual Studio片段執行此操作。 – itowlson 2009-11-04 06:33:54

1

這是我放在一起的MIT許可證的片段。您打開一個C#代碼文件,您鍵入'許可證'選項卡兩次,並且默認爲年份和版權持有人部分。

以下是describes the process的鏈接。希望這可以幫助。

 
    <?xml version="1.0" encoding="utf-8" ?> 
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> 
    <CodeSnippet Format="1.0.0"> 
    <Header> 
     <Title>Simple MIT License</Title> 
     <Shortcut>license</Shortcut> 
     <Description> 
     The standard MIT licnese. 
     </Description> 
     <Author>Example License</Author> 
     <SnippetTypes>  
     <SnippetType>Expansion</SnippetType> 
     </SnippetTypes> 
    </Header> 
    <Snippet> 
    <Declarations> 
    <Literal> 
     <ID>year</ID> 
     <ToolTip>Copyright year</ToolTip> 
     <Default>year</Default> 
    </Literal> 
    <Literal> 
     <ID>copyrightholders</ID> 
     <ToolTip>Replace This With the Copyright Holders name</ToolTip> 
     <Default>copyrightholders</Default> 
    </Literal> 
    </Declarations> 
    <Code Language="CSharp"> 
    <![CDATA[ 
    /* 
     The MIT License 

     Copyright (c) $year$ $copyrightholders$ 

     Permission is hereby granted, free of charge, to any person obtaining a copy 
     of this software and associated documentation files (the "Software"), to deal 
     in the Software without restriction, including without limitation the rights 
     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
     copies of the Software, and to permit persons to whom the Software is 
     furnished to do so, subject to the following conditions: 

     The above copyright notice and this permission notice shall be included in 
     all copies or substantial portions of the Software. 

     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
     THE SOFTWARE. 
    */ 
    ]]> 
    </Code> 
    </Snippet> 
    </CodeSnippet> 
</CodeSnippets> 
相關問題