上一篇说到重写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 实现任意文件结构的更多相关文章

  1. 自定义类使用泛型and方法使用泛型

    使用泛型的自定义类,泛型可以使用任意的数据类型,在创建对象的时候确定是什么数据类型,创建对象的时候不使用泛型,那就默认是Object类型 格式: 使用泛型的自定义类 package cn.zhuobo ...

  2. WCF - 自定义绑定

    自定义绑定 当系统提供的某个绑定不符合服务的要求时,可使用 CustomBinding 类.所有绑定都是从绑定元素的有序集构造而来的.自定义绑定可以从一组系统提供的绑定元素生成,也可以包含用户定义的自 ...

  3. Appcan 自定义数字加减控件

    DIV部分: *这里的三个ID:as_sub_3.as_now_3.as_add_3里面的“3”可以自定义,这个对于生成任意个数的列表形式很有帮助 *cb 为执行成功后可进行回调 <div cl ...

  4. WPF教程十二:了解自定义控件的基础和自定义无外观控件

    这一篇本来想先写风格主题,主题切换.自定义配套的样式.但是最近加班.搬家.新租的房子打扫卫生,我家宝宝6月中旬要出生协调各种的事情,导致了最近精神状态不是很好,又没有看到我比较喜欢的主题风格去模仿的, ...

  5. 【面试题】Java EE面试题

    第一部分:Servlet/JSP快速入门 1.      请列举至少6种javaEE技术,并简述其作用. 解析: javaEE是一系列的技术,主要包扩13种.对于开发人员来说,了解几种主要的技术是非常 ...

  6. web第一章(html)

    HTML介绍 HyperText(超文本) Markup(标记) Language(语音) 类似于XML都是由标签组成 xml:是可扩展标记语言,标签可以任意自定义 HTML:不可以使用任意标签,学习 ...

  7. 快速开发基于 HTML5 网络拓扑图应用

    采用 HT 开发网络拓扑图非常容易,例如<入门手册>的第一个小例子麻雀虽小五脏俱全:http://www.hightopo.com/guide/guide/core/beginners/e ...

  8. ASP.NET 中 OutputCache 指令参数详解

    使用@ OutputCache指令使用@ OutputCache指令,能够实现对页面输出缓存的一般性需要.@ OutputCache指令在ASP.NET页或者页中包含的用户控件的头部声明.这种方式非常 ...

  9. 【腾讯Bugly干货分享】Redex初探与Interdex:Andorid冷启动优化

    本文来自于腾讯bugly开发者社区,未经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/583b9e3ee8992c2c2df6e6ac 导语 早在去年10月份,face ...

随机推荐

  1. ASP.NET MVC上传文件的几种方法

    1.Form表单提交 <p>Form提交</p> <form action="@Url.Action("SavePictureByForm" ...

  2. PagerSlidingTabStrip的使用

    布局 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:too ...

  3. MVC校验特性

    1.前端引入3个脚本       ①jq脚本   ②jQuery.Validate.js  ③jquery.validate.unobtrusive.js(异步验证) 2.后端加特性 在表对应的Mod ...

  4. Sql Server 连接池及其用法

    其实我们一直在使用SqlServer的连接池.在连接字符串中,Pooling为是否启用连接池,默认值为true,表示启用. 与连接池相关的两个重要参数是 Min Pool Size和 Max Pool ...

  5. uva 469 - Wetlands of Florida

    题目:给你一个矩阵和某些点,找到给的点所处连续的W区域的面积(八个方向). 分析:搜索.floodfill算法,利用搜索直接求解就可以了. 说明:注意读入数据的格式. #include <cst ...

  6. Linux中yum手动安装、手动建立仓库文件夹关联实现关联包自动安装、yum相关命令使用

               yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器.基於RPM包管理,能够从指 ...

  7. MySQL 分区表 partition线上修改分区字段,后续进一步学习partition (1)

    公司线上在用partition,有一个表的分区字段错了,需要重建,结果发现没有办法像修改主键字段或者修改索引字段那样直接一条sql搞定.而是需要建临时表,有down time,所以去仔细看了文档,研究 ...

  8. 3月23日html(五) 格式与布局练习:360浏览器布局

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> < ...

  9. 一个基础的CURL类

    /** * 一个基础的CURL类 * * @author Smala */ class curl{ public $ch; public $cookie = '/cookie'; public $rs ...

  10. ubuntu12.04安装jdk-7u79-linux-i586.tar.gz

    第一步:下载jdk-7u79-linux-i586.tar.gz 1.wget -c http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux ...