zoukankan      html  css  js  c++  java
  • Visual studio 创建文件时自动添加备注

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

    描述

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

     

    普通类文件

    操作步骤:

    1. 找出Class.cs, 存放位置:C:Program Files (x86)Microsoft Visual Studio 12.0Common7IDEItemTemplatesCSharpCode1033Class。

    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.0Common7IDEItemTemplatesCSharpTest1033BasicUnitTest

     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()
            {
            }
        }
    }

     

  • 相关阅读:
    如何显示在线人数和所在位置
    Global.asax的使用点滴 (一)
    怎样使编译后,Session值不丢失。
    VB.NET 开发AutoCAD中常见错误
    GDI 虚线画笔
    VB.NET阻止程序重复启动
    GDI文字对齐
    js获取客户端浏览器信息
    DOM 基础知识
    JavaScript 不支持重载
  • 原文地址:https://www.cnblogs.com/sql4me/p/6611058.html
Copyright © 2011-2022 走看看