zoukankan      html  css  js  c++  java
  • VS中如何自定义新建文件模板(添加自定义版权信息)

    把模板文件放置在C:\Users\DYJ\Documents\Visual Studio 2010\Templates\ItemTemplates\Visual C#目录中生效,但是会出现名称冲突,需要修改模板设置中的默认名称。

    (转发)只要将X:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates中相应的文档模板Copy到X:\My Documents\Visual Studio 2005\Templates然后修改成你需要的样式.就可以在VS中新建文件的时候,可以在MyTemplates里面看到自定义的文件模板.

    还可以直接修改 X:\Program files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplatesCache里面的模板甚至是X:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates里面的模板也能达到效果.只是这样这两种方法都有不好的地方.修改ItemTemplatesCache只是修改临时缓存模板,如果执行devenv /setup 重新配置VS就会丢失自定义的设置,如果修改ItemTemplates,就会永久更改原来的模板,无法恢复了.

    下边是从msdn copy的一些可以在模板里面用的变量,例如插入$time$就会显示当前时间.具体请看:

    Parameter
    Description

    clrversion

    Current version of the common language runtime (CLR).

    GUID [1-10]

    A GUID used to replace the project GUID in a project file. You can specify up to 10 unique GUIDs (for example, guid1).

    itemname

    The name provided by the user in the Add New Item dialog box.

    machinename

    The current computer name (for example, Computer01).

    projectname

    The name provided by the user in the New Project dialog box.

    registeredorganization

    The registry key value from HKLM\Software\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization.

    rootnamespace

    The root namespace of the current project. This parameter is used to replace the namespace in an item being added to a project.

    safeitemname

    The name provided by the user in the Add New Item dialog box, with all unsafe characters and spaces removed.

    safeprojectname

    The name provided by the user in the New Project dialog box, with all unsafe characters and spaces removed.

    time

    The current time in the format DD/MM/YYYY 00:00:00.

    userdomain

    The current user domain.

    username

    The current user name.

    year

    The current year in the format YYYY.

  • 相关阅读:
    王者齐聚!Unite 2017 Shanghai 日程讲师全揭晓
    微软在.NET官网上线.NET 架构指南频道
    期待微软平台即服务技术Service Fabric 开源
    Visual Studio 20周年软件趋势随想
    .NET 十五岁,谈谈我眼中的.NET
    API网关Ocelot 使用Polly 处理部分失败问题
    互联网背景下知识半衰期这么短,如何学习?
    CentOS 7 上面安装PowerShell
    搭建consul 集群
    Entity Framework Core 实现MySQL 的TimeStamp/RowVersion 并发控制
  • 原文地址:https://www.cnblogs.com/dyj057/p/2424237.html
Copyright © 2011-2022 走看看