问题
I want to add creator name into when all .cs and .xml files created. So I could use Eclipse as follows, but I cannot use this in Visual Studio
Window -> Preferences -> Java -> Code Style -> Code templates
/**
* @author ${user}
*
* ${tags}
*/
I'm open to suggestions on how to do this.
回答1:
You can change the template for your classes that can usually be found under:
C:\Program Files (x86)\Microsoft Visual Studio version\Common7\IDE\ItemTemplates\CSharp\
Something like this:
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$
{
}
}
The complete list of Template Parameters you can find Here.
In VS2015 the cs file located in:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.cs
来源:https://stackoverflow.com/questions/46195179/adding-author-name-automatically-in-c-sharp