自定义VS的ItemTemplates 实现任意文件结构
上一篇说到重写IHttpHandler实现前后端分离,这次说一下如何建立一个如下文件结构。
VS建立webform时是根据模板来的。C#的模板目录如下:
F:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplatesCache\CSharp
WebForm的模板目录如下:
F:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ItemTemplatesCache\CSharp\Web\Web Forms\2052\WebForm
里面有几个文件
打开原WebForm.vstemplate可以看到以下代码:
- <VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
- <TemplateData>
- <Name Package="{39c9c826-8ef8-4079-8c95-428f5b1c323f}" ID="3062"/>
- <Description Package="{39c9c826-8ef8-4079-8c95-428f5b1c323f}" ID="3063"/>
- <Icon Package="{39c9c826-8ef8-4079-8c95-428f5b1c323f}" ID="4533"/>
- <NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
- <TemplateID>Microsoft.WAP.CSharp.WebForm</TemplateID>
- <TemplateGroupID>Web</TemplateGroupID>
- <ProjectType>CSharp</ProjectType>
- <ProjectSubType>Web</ProjectSubType>
- <ShowByDefault>false</ShowByDefault>
- <RequiredFrameworkVersion>2.0</RequiredFrameworkVersion>
- <DefaultName>WebForm.aspx</DefaultName>
- <SortOrder>20</SortOrder>
- </TemplateData>
- <TemplateContent>
- <References>
- <Reference>
- <Assembly>System.Web</Assembly>
- </Reference>
- <Reference>
- <Assembly>System</Assembly>
- </Reference>
- <Reference>
- <Assembly>System.Data</Assembly>
- </Reference>
- <Reference>
- <Assembly>System.Drawing</Assembly>
- </Reference>
- <Reference>
- <Assembly>System.Xml</Assembly>
- </Reference>
- </References>
- <CustomParameters>
- <CustomParameter Name="$ParentExtension$" Value=".aspx"/>
- <CustomParameter Name="$ChildExtension$" Value=".cs"/>
- </CustomParameters>
- <ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.$fileinputextension$">Default.aspx</ProjectItem>
- <ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.$fileinputextension$.cs" SubType="ASPXCodeBehind">Default.aspx.cs</ProjectItem>
- <ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.$fileinputextension$.designer.cs">Default.aspx.designer.cs</ProjectItem>
- </TemplateContent>
- <WizardExtension>
- <Assembly>Microsoft.VisualStudio.Web.Application, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
- <FullClassName>Microsoft.VisualStudio.Web.Application.WATemplateWizard</FullClassName>
- </WizardExtension>
- </VSTemplate>
想改成.html嵌套.cs,修改WebForm.vstemplate为:
- <VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
- <TemplateData>
- <Name Package="{39c9c826-8ef8-4079-8c95-428f5b1c323f}" ID="3062"/>
- <Description Package="{39c9c826-8ef8-4079-8c95-428f5b1c323f}" ID="3063"/>
- <Icon Package="{39c9c826-8ef8-4079-8c95-428f5b1c323f}" ID="4533"/>
- <NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
- <TemplateID>Microsoft.WAP.CSharp.WebForm</TemplateID>
- <TemplateGroupID>Web</TemplateGroupID>
- <ProjectType>CSharp</ProjectType>
- <ProjectSubType>Web</ProjectSubType>
- <ShowByDefault>false</ShowByDefault>
- <RequiredFrameworkVersion>2.0</RequiredFrameworkVersion>
- <DefaultName>WebForm.html</DefaultName>
- <SortOrder>20</SortOrder>
- </TemplateData>
- <TemplateContent>
- <References>
- <Reference>
- <Assembly>System.Web</Assembly>
- </Reference>
- <Reference>
- <Assembly>System</Assembly>
- </Reference>
- <Reference>
- <Assembly>System.Data</Assembly>
- </Reference>
- <Reference>
- <Assembly>System.Drawing</Assembly>
- </Reference>
- <Reference>
- <Assembly>System.Xml</Assembly>
- </Reference>
- </References>
- <CustomParameters>
- <CustomParameter Name="$ParentExtension$" Value=".html"/>
- <CustomParameter Name="$ChildExtension$" Value=".cs"/>
- </CustomParameters>
- <ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.html">Default.html</ProjectItem>
- <ProjectItem ReplaceParameters="true" TargetFileName="$fileinputname$.cs" SubType="ASPXCodeBehind">Default.cs</ProjectItem>
- </TemplateContent>
- <WizardExtension>
- <Assembly>Microsoft.VisualStudio.Web.Application, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
- <FullClassName>Microsoft.VisualStudio.Web.Application.WATemplateWizard</FullClassName>
- </WizardExtension>
- </VSTemplate>
把里面模板里面关联文件修改如下:(.html和.cs文件可以更具公司平台做一标准页面出来。)
如果不是原生WebForm要用服务器控件Default.aspx.designer.cs ,可以删掉。
改好之后建个文件试试吧
自定义VS的ItemTemplates 实现任意文件结构的更多相关文章
- 自定义类使用泛型and方法使用泛型
使用泛型的自定义类,泛型可以使用任意的数据类型,在创建对象的时候确定是什么数据类型,创建对象的时候不使用泛型,那就默认是Object类型 格式: 使用泛型的自定义类 package cn.zhuobo ...
- WCF - 自定义绑定
自定义绑定 当系统提供的某个绑定不符合服务的要求时,可使用 CustomBinding 类.所有绑定都是从绑定元素的有序集构造而来的.自定义绑定可以从一组系统提供的绑定元素生成,也可以包含用户定义的自 ...
- Appcan 自定义数字加减控件
DIV部分: *这里的三个ID:as_sub_3.as_now_3.as_add_3里面的“3”可以自定义,这个对于生成任意个数的列表形式很有帮助 *cb 为执行成功后可进行回调 <div cl ...
- WPF教程十二:了解自定义控件的基础和自定义无外观控件
这一篇本来想先写风格主题,主题切换.自定义配套的样式.但是最近加班.搬家.新租的房子打扫卫生,我家宝宝6月中旬要出生协调各种的事情,导致了最近精神状态不是很好,又没有看到我比较喜欢的主题风格去模仿的, ...
- 【面试题】Java EE面试题
第一部分:Servlet/JSP快速入门 1. 请列举至少6种javaEE技术,并简述其作用. 解析: javaEE是一系列的技术,主要包扩13种.对于开发人员来说,了解几种主要的技术是非常 ...
- web第一章(html)
HTML介绍 HyperText(超文本) Markup(标记) Language(语音) 类似于XML都是由标签组成 xml:是可扩展标记语言,标签可以任意自定义 HTML:不可以使用任意标签,学习 ...
- 快速开发基于 HTML5 网络拓扑图应用
采用 HT 开发网络拓扑图非常容易,例如<入门手册>的第一个小例子麻雀虽小五脏俱全:http://www.hightopo.com/guide/guide/core/beginners/e ...
- ASP.NET 中 OutputCache 指令参数详解
使用@ OutputCache指令使用@ OutputCache指令,能够实现对页面输出缓存的一般性需要.@ OutputCache指令在ASP.NET页或者页中包含的用户控件的头部声明.这种方式非常 ...
- 【腾讯Bugly干货分享】Redex初探与Interdex:Andorid冷启动优化
本文来自于腾讯bugly开发者社区,未经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/583b9e3ee8992c2c2df6e6ac 导语 早在去年10月份,face ...
随机推荐
- 纯js滑动脚本
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- SqlServer死锁与阻塞检测脚本
IF EXISTS (SELECT * FROM sysobjects WHERE [name] = 'sp_Lock_Scan') DROP PROCEDURE sp_Lock_Scan GO CR ...
- [c#]asp.net开发微信公众平台(3)微信消息封装及反射赋值
上一篇已经搭建好整体框架,实现了入口的验证, 验证通过后就交给LookMsgType方法处理,LookMsgType方法主要是对微信发来的不同的消息进行分解,不同的类型交给业务逻辑层不同的方法处理 ...
- 自定义函数标签(JSTL)
创建自定义函数标签步骤: 1.创建类,并且方法只能是静态 public static void operation(calculator cal) 2.书写tld <taglib xmlns=& ...
- 使用ffmpeg录音
官方教程:http://ffmpeg.org/ffmpeg.html 录音方法: 开始找到了这个方法,但是不行呀,好像是没有这个oss吧. oss 是linux 下的声音相关的东西,与alsa 一样, ...
- mysql索引之唯一索引
mysql 的唯一索引一般用于不重复的字段,一般会把表中的id设为唯一索引,创建唯一索引的目的不是为了提高查询速度,而是为了避免数据重复,注意:唯一索引可以有多个,但是列值必须唯一,创建唯一索引使用关 ...
- 关于在transform下的子元素设置fixed无效的困惑
最近的项目是要实现一个点击显示隐藏边栏的效果,而且需要边栏随着滚动而滚动. 思路简单,不就一个css的动画和一个position为fixed,搞定!但不想,设为fixed的子元素竟然无法fixed,这 ...
- Qt跨线程信号和槽的连接(默认方式是直连和队列的折中)
Qt支持三种类型的信号-槽连接:1,直接连接,当signal发射时,slot立即调用.此slot在发射signal的那个线程中被执行(不一定是接收对象生存的那个线程)2,队列连接,当控制权回到对象属于 ...
- Qt中文乱码问题(比较清楚,同一个二进制串被解释成不同的语言)
文章来源:http://blog.csdn.net/brave_heart_lxl/article/details/7186631 以下是dbzhang关于qt中文乱码问题原因的阐述,觉得不错: 首先 ...
- 如何将android studio项目转换成eclipse
更新:虽然本人坚守eclipse很久,但是现在我也不再推荐继续用eclispe了,自己的项目用还没什么问题,但是你如果想用github上的项目,用eclispe会越来越难.如果你仍然感兴趣,继续看下面 ...