日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

vs代码模板制作

發布時間:2023/12/10 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vs代码模板制作 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

VS2008代碼模板制作

一,類模板制作:

路徑:C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\CSharp\Code\2052\Class.zip

操作:打開Class.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System; using System.Collections.Generic; $if$ ($targetframeworkversion$ >= 3.5)using System.Linq; $endif$using System.Text;namespace $rootnamespace$ {/// <summary>/// $itemname$類/// </summary>public class $safeitemrootname${} } View Code

二,Windows的項目模板制作:

路徑:C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache\CSharp\Windows\2052\WindowsApplication.zip

操作:

1,打開assemblyinfo.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices;// 有關程序集的常規信息通過下列屬性集 // 控制。更改這些屬性值可修改 // 與程序集關聯的信息。 [assembly: AssemblyTitle("$projectname$")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("$registeredorganization$")] [assembly: AssemblyProduct("$projectname$")] [assembly: AssemblyCopyright("Copyright ? $registeredorganization$ $year$")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]// 將 ComVisible 設置為 false 使此程序集中的類型 // 對 COM 組件不可見。如果需要從 COM 訪問此程序集中的類型, // 則將該類型上的 ComVisible 屬性設置為 true。 [assembly: ComVisible(false)]// 如果此項目向 COM 公開,則下列 GUID 用于類型庫的 ID [assembly: Guid("$guid1$")]// 程序集的版本信息由下面四個值組成: // // 主版本 // 次版本 // 內部版本號 // 修訂號 // // 可以指定所有這些值,也可以使用“內部版本號”和“修訂號”的默認值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] View Code

2,用記事本打開csWindowsApplication.vstemplate文件,編輯內容如下:

<?xml version="1.0" encoding="utf-8"?> <VSTemplate Version="3.0.0" Type="Project" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"><TemplateData><Name Package="{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}" ID="2318" /><Description Package="{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}" ID="2319" /><Icon Package="{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}" ID="4554" /><TemplateID>Microsoft.CSharp.WindowsFormsApplication</TemplateID><ProjectType>CSharp</ProjectType><RequiredFrameworkVersion>2.0</RequiredFrameworkVersion><SortOrder>10</SortOrder><NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp><CreateNewFolder>true</CreateNewFolder><DefaultName>WindowsFormsApplication</DefaultName><ProvideDefaultName>true</ProvideDefaultName></TemplateData><TemplateContent><Project File="WindowsApplication.csproj" ReplaceParameters="true"><ProjectItem ReplaceParameters="true" TargetFileName="Properties\AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem><ProjectItem TargetFileName="Properties\Resources.resx">Resources.resx</ProjectItem><ProjectItem ReplaceParameters="true" TargetFileName="Properties\Resources.Designer.cs">Resources.Designer.cs</ProjectItem><ProjectItem TargetFileName="Properties\Settings.settings">Settings.settings</ProjectItem><ProjectItem ReplaceParameters="true" TargetFileName="Properties\Settings.Designer.cs">Settings.Designer.cs</ProjectItem><ProjectItem ReplaceParameters="true" OpenInEditor="true">MainFrm.cs</ProjectItem><ProjectItem ReplaceParameters="true">MainFrm.Designer.cs</ProjectItem><ProjectItem ReplaceParameters="true">Program.cs</ProjectItem></Project></TemplateContent> </VSTemplate> View Code

3,打開MainFrm.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;/// <summary> /// 命名空間 /// </summary> namespace $safeprojectname$ {/// <summary>/// $itemname$窗體/// </summary>public partial class MainFrm : Form{/// <summary>/// 構造函數/// </summary>public MainFrm(){this.InitializeComponent();}} } View Code

4,打開MainFrm.designer.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.Designer.cs" company="fengjin"> // 創建時間: $time$ // </copyright>/// <summary> /// 命名空間 /// </summary> namespace $safeprojectname$ {/// <summary>/// MainFrm窗體/// </summary>public partial class MainFrm{/// <summary>/// 必需的設計器變量。/// </summary>private System.ComponentModel.IContainer components = null;/// <summary>/// 清理所有正在使用的資源。/// </summary>/// <param name="disposing">如果應釋放托管資源,為 true;否則為 false。</param>protected override void Dispose(bool disposing){if (disposing && (this.components != null)){this.components.Dispose();}base.Dispose(disposing);}#region Windows 窗體設計器生成的代碼/// <summary>/// 設計器支持所需的方法 - 不要/// 使用代碼編輯器修改此方法的內容。/// </summary>private void InitializeComponent(){this.components = new System.ComponentModel.Container();this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.Text = "MainFrm";}#endregion} } View Code

5,打開Program.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms;/// <summary> /// 命名空間 /// </summary> namespace $safeprojectname$ {/// <summary>/// 應用程序的主入口點。/// </summary>internal static class Program{/// <summary>/// 應用程序的主入口點。/// </summary> [STAThread]internal static void Main(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(new MainFrm());}} } View Code

6,打開windowsapplication.csproj文件,編輯內容如下:

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration><Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform><ProductVersion>8.0.30703</ProductVersion><SchemaVersion>2.0</SchemaVersion><ProjectGuid>$guid1$</ProjectGuid><OutputType>WinExe</OutputType><AppDesignerFolder>Properties</AppDesignerFolder><RootNamespace>$safeprojectname$</RootNamespace><AssemblyName>$safeprojectname$</AssemblyName><TargetFrameworkVersion>v$targetframeworkversion$</TargetFrameworkVersion><FileAlignment>512</FileAlignment></PropertyGroup><PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "><DebugSymbols>true</DebugSymbols><DebugType>full</DebugType><Optimize>false</Optimize><OutputPath>bin\Debug\</OutputPath><DefineConstants>DEBUG;TRACE</DefineConstants><ErrorReport>prompt</ErrorReport><WarningLevel>4</WarningLevel></PropertyGroup><PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "><DebugType>pdbonly</DebugType><Optimize>true</Optimize><OutputPath>bin\Release\</OutputPath><DefineConstants>TRACE</DefineConstants><ErrorReport>prompt</ErrorReport><WarningLevel>4</WarningLevel></PropertyGroup><ItemGroup><Reference Include="System"/>$if$ ($targetframeworkversion$ == 3.5)<Reference Include="System.Core"><RequiredTargetFramework>3.5</RequiredTargetFramework></Reference><Reference Include="System.Xml.Linq"><RequiredTargetFramework>3.5</RequiredTargetFramework></Reference><Reference Include="System.Data.DataSetExtensions"><RequiredTargetFramework>3.5</RequiredTargetFramework></Reference>$endif$<Reference Include="System.Data"/><Reference Include="System.Deployment"/><Reference Include="System.Drawing"/><Reference Include="System.Windows.Forms"/><Reference Include="System.Xml"/></ItemGroup><ItemGroup><Compile Include="MainFrm.cs"><SubType>Form</SubType></Compile><Compile Include="MainFrm.Designer.cs"><DependentUpon>MainFrm.cs</DependentUpon></Compile><Compile Include="Program.cs" /><Compile Include="Properties\AssemblyInfo.cs" /><EmbeddedResource Include="Properties\Resources.resx"><Generator>ResXFileCodeGenerator</Generator><LastGenOutput>Resources.Designer.cs</LastGenOutput><SubType>Designer</SubType></EmbeddedResource><Compile Include="Properties\Resources.Designer.cs"><AutoGen>True</AutoGen><DependentUpon>Resources.resx</DependentUpon></Compile><None Include="Properties\Settings.settings"><Generator>SettingsSingleFileGenerator</Generator><LastGenOutput>Settings.Designer.cs</LastGenOutput></None><Compile Include="Properties\Settings.Designer.cs"><AutoGen>True</AutoGen><DependentUpon>Settings.settings</DependentUpon><DesignTimeSharedInput>True</DesignTimeSharedInput></Compile></ItemGroup><Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /><!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets.<Target Name="BeforeBuild"></Target><Target Name="AfterBuild"></Target>--></Project> View Code

Windows的項目模板制作我打了包,點擊這里下載WindowsApplication08.zip

三,類庫模板制作:

路徑:C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache\CSharp\Windows\2052\ClassLibrary.zip

操作:打開assemblyinfo.cs,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices;// 有關程序集的常規信息通過下列屬性集 // 控制。更改這些屬性值可修改 // 與程序集關聯的信息。 [assembly: AssemblyTitle("$projectname$")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("$registeredorganization$")] [assembly: AssemblyProduct("$projectname$")] [assembly: AssemblyCopyright("Copyright ? $registeredorganization$ $year$")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]// 將 ComVisible 設置為 false 使此程序集中的類型 // 對 COM 組件不可見。如果需要從 COM 訪問此程序集中的類型, // 則將該類型上的 ComVisible 屬性設置為 true。 [assembly: ComVisible(false)]// 如果此項目向 COM 公開,則下列 GUID 用于類型庫的 ID [assembly: Guid("$guid1$")]// 程序集的版本信息由下面四個值組成: // // 主版本 // 次版本 // 內部版本號 // 修訂號 // // 可以指定所有這些值,也可以使用“內部版本號”和“修訂號”的默認值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] View Code

四,WebApplicationProject的項目模板制作:

路徑:C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache\CSharp\Web\2052\WebApplicationProject.zip

操作:

1,打開assemblyinfo.cs,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices;// 有關程序集的常規信息通過下列屬性集 // 控制。更改這些屬性值可修改 // 與程序集關聯的信息。 [assembly: AssemblyTitle("$safeprojectname$")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("$registeredorganization$")] [assembly: AssemblyProduct("$safeprojectname$")] [assembly: AssemblyCopyright("Copyright ? $registeredorganization$ $year$")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]// 將 ComVisible 設置為 false 使此程序集中的類型 // 對 COM 組件不可見。如果需要從 COM 訪問此程序集中的類型, // 則將該類型的 ComVisible 屬性設置為 true。 [assembly: ComVisible(false)]// 如果此項目向 COM 公開,則下列 GUID 用于類型庫的 ID [assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]// 程序集的版本信息由下面四個值組成: // // 主版本 // 次版本 // 內部版本號 // 修訂號 // // 可以指定所有這些值,也可以使用“修訂號”和“內部版本號”的默認值, // 方法是按如下所示使用“*”: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] View Code

2,打開Default.aspx.cs,編輯內容如下:

// <copyright file="$safeitemname$.aspx.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;namespace $safeprojectname$ {/// <summary>/// 后臺頁面邏輯/// </summary>public partial class _Default : System.Web.UI.Page{/// <summary>/// 初始化加載/// </summary>/// <param name="sender">對象</param>/// <param name="e">事件參數</param>protected void Page_Load(object sender, EventArgs e){}} } View Code

?五,ConsoleApplication的項目模板制作:

路徑:C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache\CSharp\Windows\2052\ConsoleApplication.zip

操作:

1,打開assemblyinfo.cs,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices;// 有關程序集的常規信息通過下列屬性集 // 控制。更改這些屬性值可修改 // 與程序集關聯的信息。 [assembly: AssemblyTitle("$projectname$")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("$registeredorganization$")] [assembly: AssemblyProduct("$projectname$")] [assembly: AssemblyCopyright("Copyright ? $registeredorganization$ $year$")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]// 將 ComVisible 設置為 false 使此程序集中的類型 // 對 COM 組件不可見。如果需要從 COM 訪問此程序集中的類型, // 則將該類型上的 ComVisible 屬性設置為 true。 [assembly: ComVisible(false)]// 如果此項目向 COM 公開,則下列 GUID 用于類型庫的 ID [assembly: Guid("$guid1$")]// 程序集的版本信息由下面四個值組成: // // 主版本 // 次版本 // 內部版本號 // 修訂號 // // 可以指定所有這些值,也可以使用“內部版本號”和“修訂號”的默認值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] View Code

2,打開program.cs,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace $safeprojectname$ {/// <summary>/// 程序入口/// </summary>internal class Program{/// <summary>/// 程序入口/// </summary>/// <param name="args">參數</param>private static void Main(string[] args){}} } View Code

?

VS2010代碼模板制作

一,類模板制作:

路徑:C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\CSharp\Code\2052\Class.zip

操作:打開Class.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System; using System.Collections.Generic; $if$ ($targetframeworkversion$ >= 3.5)using System.Linq; $endif$using System.Text;namespace $rootnamespace$ {/// <summary>/// $itemname$類/// </summary>public class $safeitemrootname${} } View Code

二,Windows的項目模板制作:

路徑:C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache\CSharp\Windows\2052\WindowsApplication.zip

操作:

1,打開assemblyinfo.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices;// 有關程序集的常規信息通過以下 // 特性集控制。更改這些特性值可修改 // 與程序集關聯的信息。 [assembly: AssemblyTitle("$projectname$")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("$registeredorganization$")] [assembly: AssemblyProduct("$projectname$")] [assembly: AssemblyCopyright("Copyright ? $registeredorganization$ $year$")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]// 將 ComVisible 設置為 false 使此程序集中的類型 // 對 COM 組件不可見。如果需要從 COM 訪問此程序集中的類型, // 則將該類型上的 ComVisible 特性設置為 true。 [assembly: ComVisible(false)]// 如果此項目向 COM 公開,則下列 GUID 用于類型庫的 ID [assembly: Guid("$guid1$")]// 程序集的版本信息由下面四個值組成: // // 主版本 // 次版本 // 內部版本號 // 修訂號 // // 可以指定所有這些值,也可以使用“內部版本號”和“修訂號”的默認值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] View Code

2,用記事本打開csWindowsApplication.vstemplate文件,編輯內容如下:

<?xml version="1.0" encoding="utf-8"?> <VSTemplate Version="3.0.0" Type="Project" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"><TemplateData><Name Package="{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}" ID="2318" /><Description Package="{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}" ID="2319" /><Icon Package="{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}" ID="4554" /><TemplateID>Microsoft.CSharp.WindowsFormsApplication</TemplateID><ProjectType>CSharp</ProjectType><RequiredFrameworkVersion>2.0</RequiredFrameworkVersion><SortOrder>10</SortOrder><NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp><CreateNewFolder>true</CreateNewFolder><DefaultName>WindowsFormsApplication</DefaultName><ProvideDefaultName>true</ProvideDefaultName></TemplateData><TemplateContent><Project File="WindowsApplication.csproj" ReplaceParameters="true"><ProjectItem ReplaceParameters="true" TargetFileName="Properties\AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem><ProjectItem TargetFileName="Properties\Resources.resx">Resources.resx</ProjectItem><ProjectItem ReplaceParameters="true" TargetFileName="Properties\Resources.Designer.cs">Resources.Designer.cs</ProjectItem><ProjectItem TargetFileName="Properties\Settings.settings">Settings.settings</ProjectItem><ProjectItem ReplaceParameters="true" TargetFileName="Properties\Settings.Designer.cs">Settings.Designer.cs</ProjectItem><ProjectItem ReplaceParameters="true" OpenInEditor="true">MainFrm.cs</ProjectItem><ProjectItem ReplaceParameters="true">MainFrm.Designer.cs</ProjectItem><ProjectItem ReplaceParameters="true">Program.cs</ProjectItem><ProjectItem ReplaceParameters="true">App.config</ProjectItem></Project></TemplateContent> </VSTemplate> View Code

3,打開MainFrm.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; $if$ ($targetframeworkversion$ >= 3.5)using System.Linq; $endif$using System.Text; using System.Windows.Forms;/// <summary> /// 命名空間 /// </summary> namespace $safeprojectname$ {/// <summary>/// $itemname$窗體/// </summary>public partial class MainFrm : Form{/// <summary>/// 構造函數/// </summary>public MainFrm(){this.InitializeComponent();}} } View Code

4,打開MainFrm.designer.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.Designer.cs" company="fengjin"> // 創建時間: $time$ // </copyright>/// <summary> /// 命名空間 /// </summary> namespace $safeprojectname$ {/// <summary>/// MainFrm窗體/// </summary>public partial class MainFrm{/// <summary>/// 必需的設計器變量。/// </summary>private System.ComponentModel.IContainer components = null;/// <summary>/// 清理所有正在使用的資源。/// </summary>/// <param name="disposing">如果應釋放托管資源,為 true;否則為 false。</param>protected override void Dispose(bool disposing){if (disposing && (this.components != null)){this.components.Dispose();}this.Dispose(disposing);}#region Windows 窗體設計器生成的代碼/// <summary>/// 設計器支持所需的方法 - 不要/// 使用代碼編輯器修改此方法的內容。/// </summary>private void InitializeComponent(){this.components = new System.ComponentModel.Container();this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.Text = "MainFrm";}#endregion} } View Code

5,打開Program.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System; using System.Collections.Generic; $if$ ($targetframeworkversion$ >= 3.5)using System.Linq; $endif$using System.Windows.Forms;/// <summary> /// 命名空間 /// </summary> namespace $safeprojectname$ {/// <summary>/// 應用程序的主類/// </summary>internal static class Program{/// <summary>/// 應用程序的主入口點。/// </summary> [STAThread]internal static void Main(){Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(new MainFrm());}} } View Code

6,打開windowsapplication.csproj文件,編輯內容如下:

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"><PropertyGroup><Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration><Platform Condition=" '$(Platform)' == '' ">x86</Platform><ProductVersion>8.0.30703</ProductVersion><SchemaVersion>2.0</SchemaVersion><ProjectGuid>$guid1$</ProjectGuid><OutputType>WinExe</OutputType><AppDesignerFolder>Properties</AppDesignerFolder><RootNamespace>$safeprojectname$</RootNamespace><AssemblyName>$safeprojectname$</AssemblyName><TargetFrameworkVersion>v$targetframeworkversion$</TargetFrameworkVersion>$if$ ($targetframeworkversion$ >= 4.0)<TargetFrameworkProfile>Client</TargetFrameworkProfile>$endif$<FileAlignment>512</FileAlignment></PropertyGroup><PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "><PlatformTarget>x86</PlatformTarget><DebugSymbols>true</DebugSymbols><DebugType>full</DebugType><Optimize>false</Optimize><OutputPath>bin\Debug\</OutputPath><DefineConstants>DEBUG;TRACE</DefineConstants><ErrorReport>prompt</ErrorReport><WarningLevel>4</WarningLevel></PropertyGroup><PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "><PlatformTarget>x86</PlatformTarget><DebugType>pdbonly</DebugType><Optimize>true</Optimize><OutputPath>bin\Release\</OutputPath><DefineConstants>TRACE</DefineConstants><ErrorReport>prompt</ErrorReport><WarningLevel>4</WarningLevel></PropertyGroup><ItemGroup><Reference Include="System"/>$if$ ($targetframeworkversion$ >= 3.5)<Reference Include="System.Core"/><Reference Include="System.Xml.Linq"/><Reference Include="System.Data.DataSetExtensions"/>$endif$$if$ ($targetframeworkversion$ >= 4.0)<Reference Include="Microsoft.CSharp"/>$endif$<Reference Include="System.Data"/><Reference Include="System.Deployment"/><Reference Include="System.Drawing"/><Reference Include="System.Windows.Forms"/><Reference Include="System.Xml"/></ItemGroup><ItemGroup><Compile Include="MainFrm.cs"><SubType>Form</SubType></Compile><Compile Include="MainFrm.Designer.cs"><DependentUpon>MainFrm.cs</DependentUpon></Compile><Compile Include="Program.cs" /><Compile Include="Properties\AssemblyInfo.cs" /><EmbeddedResource Include="Properties\Resources.resx"><Generator>ResXFileCodeGenerator</Generator><LastGenOutput>Resources.Designer.cs</LastGenOutput><SubType>Designer</SubType></EmbeddedResource><Compile Include="Properties\Resources.Designer.cs"><AutoGen>True</AutoGen><DependentUpon>Resources.resx</DependentUpon></Compile><None Include="Properties\Settings.settings"><Generator>SettingsSingleFileGenerator</Generator><LastGenOutput>Settings.Designer.cs</LastGenOutput></None><Compile Include="Properties\Settings.Designer.cs"><AutoGen>True</AutoGen><DependentUpon>Settings.settings</DependentUpon><DesignTimeSharedInput>True</DesignTimeSharedInput></Compile></ItemGroup>$if$ ($targetframeworkversion$ > 4.0)<ItemGroup><None Include="App.config" /></ItemGroup>$endif$<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /><!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets.<Target Name="BeforeBuild"></Target><Target Name="AfterBuild"></Target>--></Project> View Code

Windows的項目模板制作我打了包,點擊這里下載

三,ConsoleApplication的項目模板制作:

路徑:C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache\CSharp\Windows\2052\ConsoleApplication.zip

操作:

1,打開assemblyinfo.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices;// 有關程序集的常規信息通過以下 // 特性集控制。更改這些特性值可修改 // 與程序集關聯的信息。 [assembly: AssemblyTitle("$projectname$")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("$registeredorganization$")] [assembly: AssemblyProduct("$projectname$")] [assembly: AssemblyCopyright("Copyright ? $registeredorganization$ $year$")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")]// 將 ComVisible 設置為 false 使此程序集中的類型 // 對 COM 組件不可見。如果需要從 COM 訪問此程序集中的類型, // 則將該類型上的 ComVisible 特性設置為 true。 [assembly: ComVisible(false)]// 如果此項目向 COM 公開,則下列 GUID 用于類型庫的 ID [assembly: Guid("$guid1$")]// 程序集的版本信息由下面四個值組成: // // 主版本 // 次版本 // 內部版本號 // 修訂號 // // 可以指定所有這些值,也可以使用“內部版本號”和“修訂號”的默認值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] View Code

2,打開文件program.cs,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System; using System.Collections.Generic; $if$ ($targetframeworkversion$ >= 3.5)using System.Linq; $endif$using System.Text;/// <summary> /// 命名空間 /// </summary> namespace $safeprojectname$ {/// <summary>/// 應用程序的主類/// </summary>internal class Program{/// <summary>/// 應用程序的主入口點。/// </summary>/// <param name="args">args</param>internal static void Main(string[] args){}} } View Code

ConsoleApplication的項目模板制作我打了包,點擊這里下載ConsoleApplication.zip.rar

?

?VS2012代碼模板制作

一,類模板制作:

路徑:C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplatesCache\CSharp\Code\2052\Class

操作:打開Class.cs文件,編輯內容如下:

// <copyright file="$safeitemname$.cs" company="fengjin"> // 創建時間: $time$ // </copyright>using System; using System.Collections.Generic; $if$ ($targetframeworkversion$ >= 3.5)using System.Linq; $endif$using System.Text; $if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks; $endif$ namespace $rootnamespace$ {/// <summary>/// $itemname$類/// </summary>public class $safeitemrootname${} } View Code

?二,Windows的項目模板制作:

路勁:C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ProjectTemplatesCache\CSharp\Windows\2052\WindowsApplication

Windows的項目模板制作我打了包,點擊這里下載WindowsApplication12.zip

?

有個東西,不知道是啥,目前我就叫它變量吧。下面列舉一些變量的具體含義:

$safeitemname$:文件名字

$safeitemrootname$:類名

$time$:時間

$clrversion$:CLR版本

$itemname$:類名稱

$machinename$:機器名稱

$rootnamespace$:命名空間

$username$:作者

$targetframeworkversion$:目前框架版本,例如為:3.5

$if$ :

$endif$:

?

轉載于:https://www.cnblogs.com/fengjin/p/4471235.html

總結

以上是生活随笔為你收集整理的vs代码模板制作的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。