Visual Studio template-custom WebForm Template

Source: Internet
Author: User

 

Preface

In my previous article, I mentioned that we recommend using PageBase for unified permission and other operations. Then, each page inherits this PageBase, which may be troublesome for some friends, every time you create a new page, you must manually inherit it. This article will solve this problem for you.

 

Environment

Microsoft Visual maxcompute 2008

 

Body

Visual Studio has powerful template functions, such as creating a project, creating a project, and creating a website. You can modify or customize the template. In practical applications, in addition to unified permission control, copyright information is often required. This article only briefly describes the custom WebForm template. Note, according to the references, the second method cannot export the WebForm template!

1. Copy the WebForm template that comes with Visual Studio to any directory.

Microsoft Visual maxcompute 2008:

Microsoft Visual Studio 9.0 \ Common7 \ IDE \ ItemTemplates \ Web \ CSharp \ 2052 \ WebForm.zip

Microsoft Visual maxcompute 2005:

Microsoft Visual Studio 8 \ Common7 \ IDE \ ItemTemplates \ Web \ CSharp \ 2052 \ WebForm.zip

 

2. Decompress webform.zip and directly modify CodeBeside. cs with copyright information and PageBase

// ================================================ ==============
//*
// OPERATOR: farmer's uncle
// Mail: over140@gmail.com
// Bo KE: http://over140.cnblogs.com/
// Time: $ time $
// Description:
//*
// ================================================ ==============

Using System;
Using System. Collections. Generic;
Using System. Web;
Using System. Web. UI;
Using System. Web. UI. WebControls;

Public partial class $ codebesideclassname $: PageBase
{
Protected void Page_Load (object sender, EventArgs e)
{

}
}

$ Time $ date in DD/MM/YYYY 00:00:00 format will be generated as per the document, but what I generate is the date of YYYY-MM-DD 00:00:00, my Visual Studio language is a Simplified Chinese version, is it related to this? $ Codebesideclassname $ that is, the reason why I cannot create a template by creating a WebForm. This is not found in the default template parameters. This is a specific parameter, the template engine is required for parsing. in vstemplate, we can see the WizardExtension node. The parsing template engine is specified below. Note that parsing fails if other redundant page templates are deleted, show you $ codebesideclassname $ as the class name.

If you want to modify other information such as the template display name, you need to modify WebForm. vstemplate. Modify the Name in TemplateData. Other parameter descriptions can be displayed in Visual Studio.

 

3. compress the modified file into a ZIP package.

Note that the directory structure should not be changed. Double-click the compressed files. These files should be displayed in the root directory, and then copy the files:

C: \ Documents ents and Settings \ current user \ My Documents ents \ Visual Studio 2008 \ Templates \ ItemTemplates

C: \ Documents ents and Settings \ current user \ My Documents ents \ Visual Studio 2005 \ Templates \ ItemTemplates

 

4. Open Visual Studio. If it has already been opened, you can see the following in adding a new project:

Click "add" to view the desired result. Try again for the effect :)

 

5. Download and try it now.

Farmer's uncle WebForm

 

References

1. MSDN: Visual Studio Template

2. Visual Studio custom template (1)

 

End

In the face of giants, fear and fear will both fail, and the chance of success can be achieved only by trying to understand and challenge them.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.