編譯之 buildProviders 的 add 項目 (ASP.NET 設定結構描述)
將組建提供者加入集合。
這個項目是 .NET Framework 2.0 版中新增的項目。
<add
extension="custom resource file extension"
type="build provider type, build provider assembly" />
屬性和項目
下列章節會說明屬性、子項目和父項目。
屬性
屬性 |
描述 |
---|---|
extension |
必要的 String 屬性。 定義自訂資源檔副檔名。 這個屬性是集合機碼。 預設為空字串 ("")。 |
type |
必要的 String 屬性。 定義編譯 extension 屬性所指定的檔案時,所使用的型別和組件。 預設為空字串 ("")。 |
子項目
無。
父項目
項目 |
描述 |
---|---|
configuration |
指定 Common Language Runtime 和 .NET Framework 應用程式所使用之每個組態檔中的根項目 (Root Element)。 |
system.web |
指定 ASP.NET 組態區段的根項目。 |
compilation |
設定 ASP.NET 用來編譯應用程式的所有編譯設定。 |
buildProviders |
定義用來編譯自訂資源檔的組建提供者集合。 |
備註
add 項目會將組建提供者加入至 buildproviders 項目中的集合。
buildProviders 項目會定義組建提供者的集合,用來在編譯期間編譯特定檔案類型的自訂資源檔及產生程式碼。
若要在 ASP.NET 應用程式內定義檔案類型的自訂建置動作,您必須從 BuildProvider 類別衍生類別,在該衍生類別內實作用於建置檔案類型的成員,並在應用程式組態檔內設定對應副檔名的組建提供者。 如需詳細資訊,請參閱 BuildProvider。
預設組態
下列的預設 buildProviders 項目是在根 Web.config 檔中設定。
<buildProviders>
<add extension=".aspx" type="System.Web.Compilation.PageBuildProvider" />
<add extension=".ascx" type="System.Web.Compilation.UserControlBuildProvider" />
<add extension=".master" type="System.Web.Compilation.MasterPageBuildProvider" />
<add extension=".asix" type="System.Web.Compilation.ImageGeneratorBuildProvider" />
<add extension=".asmx" type="System.Web.Compilation.WebServiceBuildProvider" />
<add extension=".ashx" type="System.Web.Compilation.WebHandlerBuildProvider" />
<add extension=".soap" type="System.Web.Compilation.WebServiceBuildProvider" />
<add extension=".resx" type="System.Web.Compilation.ResXBuildProvider" />
<add extension=".resources" type="System.Web.Compilation.ResourcesBuildProvider" />
<add extension=".wsdl" type="System.Web.Compilation.WsdlBuildProvider" />
<add extension=".xsd" type="System.Web.Compilation.XsdBuildProvider"/>
<add extension=".js" type="System.Web.Compilation.ForceCopyBuildProvider" />
</buildProviders>
範例
下列程式碼範例示範如何定義組建提供者,以用於編譯具有指定副檔名的自訂資源檔。
<configuration>
<system.web>
<compilation>
<buildProviders>
<add
extension=".mafx"
type="MyBuildProviderType, MyBuildProviderAssembly"/>
</buildProviders>
</compilation>
</system.web>
</configuration>
項目資訊
組態區段處理常式 |
|
組態成員 |
|
可設定的位置 |
Machine.config 根層次的 Web.config 應用程式層級的 Web.config 虛擬或實體目錄層級的 Web.config |
需求 |
Microsoft Internet Information Services (IIS) 5.0、5.1 或 6.0 版 .NET Framework 2.0 版 Microsoft Visual Studio 2003 或 Visual Studio 2005 |
請參閱
工作
How to: Configure Specific Folders Using Location Settings
How to: Lock ASP.NET Configuration Settings
參考
編譯的 buildProviders 項目 (ASP.NET 設定結構描述)
編譯之 buildProviders 的 clear 項目 (ASP.NET 設定結構描述)
編譯組件的 remove 項目 (ASP.NET 設定結構描述)
system.web 項目 (ASP.NET 設定結構描述)
compilation 項目 (ASP.NET 設定結構描述)
概念
ASP.NET Configuration File Hierarchy
Securing ASP.NET Configuration
ASP.NET Configuration Scenarios