VisualStudio2019 C#文件自动头部注释

一、修改方法

文件路径:D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ItemTemplates\CSharp\Code\2052\Class\Class.cs
注意替换为自己的文件路径

Class.cs默认文件内容

using System;
using System.Collections.Generic;
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
$endif$using System.Text;
$if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;
$endif$
namespace $rootnamespace$
{
    class $safeitemrootname$
    {
    }
}

在头部加上自己需要的注释


/**
* Namespace: $rootnamespace$
*
* Function: N/A
* Name: $safeitemname$
*
* Ver       Time                     Author
* 0.10      $time$      Hx7013
*
*/

using System;
using System.Collections.Generic;
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
$endif$using System.Text;
$if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;
$endif$
namespace $rootnamespace$
{
    class $safeitemrootname$
    {
    }
}

效果展示
C#文件自动头部注释

二、提示无权限解决方法

操作步骤:

  1. 右键Class.cs,选择属性
  2. 点击安全选项卡
  3. 选中Users组
  4. 点击编辑
  5. 选中Users组
  6. 勾选修改属性(同步应该会自动勾上写入属性)
  7. 点击确定关闭Class.cs 的权限窗口
  8. 点击确定关闭Class.cs 属性窗口

C#文件自动头部注释

转载请注明:https://blog.csdn.net/hx7013/article/details/104490931

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章