2017-09-13 79 views
1

我想在創建所有.cs和.xml文件時添加創建者姓名。所以,我可以使用Eclipse如下,但我不能在Visual Studio中使用此在C#中自動添加作者姓名

窗口 - >首選項 - >爪哇 - >代碼樣式 - >代碼模板

/** 
* @author ${user} 
* 
* ${tags} 
*/ 

我開以及如何做到這一點的建議。

+0

你可以創建代碼片段,這將爲你做到這一點。 – SeM

+0

看到這:https://stackoverflow.com/questions/9139571/adding-author-name-in-document-header-using-stylecop – PaulF

回答

3

您可以更改通常下找到了適合自己的類模板:

C:\ Program Files文件(x86)的\微軟的Visual Studio \ Common7 \ IDE \的ItemTemplate \ CSHARP \

事情是這樣的:

using System; 
using System.Collections.Generic; 
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq; 
$endif$using System.Text; 

/** 
* @author $username$ 
* 
* @date - $time$ 
*/ 

namespace $rootnamespace$ 
{ 
    class $safeitemrootname$ 
    { 
    } 
} 

模板參數的完整列表,您可以鰭d Here

在VS2015位於CS文件:

C:\ Program Files文件(x86)的\微軟的Visual Studio 14.0 \ Common7 \ IDE \的ItemTemplate \ CSHARP \代碼\ 1033 \ Class.cs

+0

我改變並保存它,但仍然沒有改變。我也在使用VS 2015 –

+0

嘗試更改位於'C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ ItemTemplatesCache'中的'ItemTemplatesCache'文件。 – SeM

+0

@BerkayKırmızıoğlu它可以幫助你嗎? – SeM