簡體   English   中英

在 Visual Studio 2019 的 Program.cs 文件頂部自動生成注釋

[英]auto generate comments at the top of the Program.cs file in Visual Studio 2019

我是 Visual Studio 2019 和 C# 的新手。 有沒有辦法在項目解決方案 Program.cs 文件的頂部自動生成帶有文件名、作者、日期戳、版本等的注釋(理想情況下,每次創建新項目或單個 class 文件時)? 我過去在 Eclipse 和 JetBrain 的產品中通過一個簡單的模板文件完成了它,但在 Visual Studio 2019 中似乎沒有那么簡單。

我試過這個只是為了測試它:(C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ProjectTemplates\CSharp\Windows\1033\ConsoleApplication\program.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$

/** 
* $safeprojectname$
* $username$
* $time$
*/

namespace $safeprojectname$
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}

沒用。

您可以使用 EditorConfig 添加文件 header

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM