VS中如何自定义新建文件模板(添加自定义版权信息)

摘要:
将模板文件放在C:\Users DYJ Documents VisualStudio2010 Templates ItemTemplates VisualC#目录中才能生效,但会出现名称冲突,您需要修改模板设置中的默认名称。

把模板文件放置在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.

免责声明:文章转载自《VS中如何自定义新建文件模板(添加自定义版权信息)》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇c#多个按钮执行同一类事件-按钮按下和弹起gitlab配置sshkey免密拉取代码下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

使用visual studio code调试php代码

这回使用visual studio code折腾php代码的调试,又是一顿折腾,无论如何都进不了断点。好在就要放弃使用visual studio code工具的时候,折腾好了,汗~ 这里把步骤记录下来: 1、安装一站式php工具wampserver 我安装的是最新的3.1.3 64bit的版本,这个版本内置了4个版本的php,默认使用的是php 5.6.3...

visual Studio 2017 扩展开发(三)《绑定快捷键到菜单项》

如何将键盘快捷方式映射到自定义按钮,怎么使用快捷键启动自己创建的菜单,刚开始做的时候迷糊了,找了很久。可能也是因为刚开始做不是很明白,后面慢慢就懂了。其实非常简单的。 很多快捷键已经在Visual studio中使用的,在确定快捷键之前验证下你想设置的快捷键是否可以使用,当然是不可以重复啦,是吧。 验证快捷键是否被使用 工具→选项→环境,选择键盘 输入你想...

Visual Studio 2015简体中文企业版/专业版下载+有效激活密钥

Visual Studio 2015是一个基本完整的开发工具集,它包括了整个软件生命周期中所需要的大部分工具,如UML工具、代码管控工具、集成开发环境(IDE)等等。所写的目标代码适用于微软支持的所有平台,包括Microsoft Windows、Windows Mobile、Windows CE、.NET Framework、.NET Compact Fr...

Visual Studio 2019 创建 WCF服务 找不到

新安装了Visual Studio 2019想创建一个WCF服务 但就是怎么也找不到这个模版 找了半天最后在官网找到了解决办法 https://docs.microsoft.com/en-us/visualstudio/data-tools/walkthrough-creating-a-simple-wcf-service-in-windows-for...

Visual Studio中查看和修改文件编码

Visual Studio提供高级保存选项功能,它能指定特定代码文件的编码规范和行尾所使用的换行符。在Visual Studio 2017中,该命令没有默认显示在“文件”菜单中。用户需要手工设置,才能显示该命令。操作方法如下: 单击“工具”|“自定义”命令,弹出“自定义”对话框。 单击“命令”标签,进入“命令”选项卡。 在“菜单栏”下拉列表中,选择“文件...

vs设置git 忽略文件

在代码目录下建立.gitignore文件: .gitignore ,配置上要忽略的文件或者文件夹,然后提交到git 上就可以了。 如果文件已经被跟踪且被推送到远程,把本地这些文件删除再提交到远端。 git rm -r --cached . git add . git commit -m "update .gitignore"  官方.gitigonre...