add Element for buildProviders for compilation (ASP.NET Settings Schema)
Adds a build provider to the collection.
This element is new in the .NET Framework version 2.0.
<add
extension="custom resource file extension"
type="build provider type, build provider assembly"
Code | Resources | All"
/>
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Attributes
Attribute | Description |
---|---|
extension |
Required String attribute. Defines the custom resource file extension. This attribute is the collection key. The default is an empty string (""). |
type |
Required String attribute. Defines the type and assembly to use to compile the files that are specified by the extension attribute. The default is an empty string (""). |
Child Elements
None.
Parent Elements
Element | Description |
---|---|
configuration |
Specifies the root element in every configuration file that is used by the common language runtime and the .NET Framework applications. |
system.web |
Specifies the root element for the ASP.NET configuration section. |
compilation |
Configures all compilation settings that ASP.NET uses to compile applications. |
buildProviders |
Defines a collection of build providers that are used to compile custom resource files. |
Remarks
The add element adds a build provider to the collection in the buildproviders element.
The buildProviders element defines a collection of build providers that are used to compile custom resource files of a particular file type and to generate code during compilation.
To define custom build actions for a file type within an ASP.NET application, you must derive a class from the BuildProvider class, implement members within the derived class for building the file type, and configure the build provider for the corresponding file extension within the application configuration file. For information, see BuildProvider.
Default Configuration
The following default buildProviders element is configured in the root Web.config file.
<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>
Example
The following code example demonstrates how to define a build provider that is used to compile custom resource files with the specified extension.
<configuration>
<system.web>
<compilation>
<buildProviders>
<add
extension=".mafx"
type="MyBuildProviderType, MyBuildProviderAssembly"/>
</buildProviders>
</compilation>
</system.web>
</configuration>
Element Information
Configuration section handler |
|
Configuration member |
|
Configurable Locations |
Machine.config Root-level Web.config Application-level Web.config Virtual or physical directory–level Web.config |
Requirements |
Microsoft Internet Information Services (IIS) version 5.0, 5.1, or 6.0 The .NET Framework version 2.0 Microsoft Visual Studio 2003 or Visual Studio 2005 |
See Also
Tasks
How to: Configure Specific Directories Using Location Settings
How to: Lock ASP.NET Configuration Settings
Reference
buildProviders Element for compilation (ASP.NET Settings Schema)
clear Element for buildProviders for compilation (ASP.NET Settings Schema)
remove Element for assemblies for compilation (ASP.NET Settings Schema)
configuration Element (General Settings Schema)
system.web Element (ASP.NET Settings Schema)
compilation Element (ASP.NET Settings Schema)
System.Configuration
System.Web.Configuration
CompilationSection
Add
Concepts
ASP.NET Compilation Model
ASP.NET Web Page Code Model
ASP.NET Web Site Precompilation Overview
ASP.NET Configuration File Hierarchy and Inheritance
Securing ASP.NET Configuration
ASP.NET Configuration Scenarios
Other Resources
General Configuration Settings (ASP.NET)
ASP.NET Configuration Settings
Configuring ASP.NET Applications
ASP.NET Configuration Files
ASP.NET Configuration API