Visual studio 创建文件时自动添加备注

Visual studio 创建文件时自动添加备注

描述

要求每回添加一个类,普通类或单元测试类文件头自动添加备注, 比如:Copyright, FileName, Author and so on.

 

普通类文件

操作步骤:

1. 找出Class.cs, 存放位置:C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class。

2. 编辑Class.cs文件, 添加上文件备注(绿色部分)。

/*===============================================================================================

 Copyright© $year$ xxx Ltd. All rights reserved.
 
 File     : $safeitemname$.cs
 Author   : xxx xxx
 Created  : $time$ 
 Summary  : 

 ===============================================================================================*/
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$
    {
    }
}


 单元测试类文件(此处用的是NUnit测试类)

  操作步骤:

 1. 找到 UnitTest.cs, 存放位置:C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplates\CSharp\Test\1033\BasicUnitTest

 2. 编辑UnitTest.cs文件, 添加上文件备注(绿色部分), [TestFixture] and [Test]。

/*===============================================================================================

 Copyright© $year$ xxx Ltd. All rights reserved.
 
 File     : $safeitemname$.cs
 Author   : xxx xxx
 Created  : $time$ 
 Summary  : 

 ===============================================================================================*/

using System;
using NUnit.Framework;

namespace $rootnamespace$
{
    [TestFixture]
    public class $safeitemname$
    {
        [Test]
        public void TestMethod1()
        {
        }
    }
}

 

 

转载于:https://www.cnblogs.com/sql4me/p/6611058.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值