在 C# 中自动添加作者姓名

Ber*_*ğlu 1 c# tfs visual-studio

我想在所有 .cs 和 .xml 文件创建时添加创建者名称。所以我可以按如下方式使用 Eclipse,但我不能在 Visual Studio 中使用它

窗口 -> 首选项 -> Java -> 代码样式 -> 代码模板

/**
 * @author ${user}
 *
 * ${tags}
 */
Run Code Online (Sandbox Code Playgroud)

我愿意接受有关如何执行此操作的建议。

SᴇM*_*SᴇM 5

您可以更改通常可以在以下位置找到的类的模板:

C:\Program Files (x86)\Microsoft Visual Studio版本\Common7\IDE\ItemTemplates\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$
    {
    }
}
Run Code Online (Sandbox Code Playgroud)

您可以在此处找到模板参数的完整列表。

在 VS2015 中,cs 文件位于:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.cs