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

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