|
30 | 30 |
|
31 | 31 | To define custom build actions for a file type within an ASP.NET application, you must derive a class from <xref:System.Web.Compilation.BuildProvider>, 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.
|
32 | 32 |
|
33 |
| - The specifies the file extension for supported files, and whether the build provider supports code files, Web files, resource files or all files. Use the `type` attribute to specify the fully qualified type name of the build provider implementation. Use the <xref:System.Web.Compilation.BuildProviderAppliesToAttribute> class to specify whether the build provider applies to files in the App_Code directory, to files in a Web content directory, to global or local resources, or to all files. Use the `extension` attribute to specify the file extension used to identify files that the <xref:System.Web.Compilation.BuildProvider> class supports. Use the <xref:System.Web.Configuration.BuildProviderCollection> class to examine build providers in a configuration file. For more information about configuring a build provider, see [buildProviders Element for compilation (ASP.NET Settings Schema)](https://msdn.microsoft.com/library/40fa889d-5412-487a-b6a9-21eb011c2384). |
| 33 | + The `add` element specifies the file extension for supported files, and whether the build provider supports code files, Web files, resource files, or all files. Use the `type` attribute to specify the fully qualified type name of the build provider implementation. Use the <xref:System.Web.Compilation.BuildProviderAppliesToAttribute> class to specify whether the build provider applies to files in the App_Code directory, to files in a Web content directory, to global or local resources, or to all files. Use the `extension` attribute to specify the file extension used to identify files that the <xref:System.Web.Compilation.BuildProvider> class supports. Use the <xref:System.Web.Configuration.BuildProviderCollection> class to examine build providers in a configuration file. For more information about configuring a build provider, see [buildProviders Element for compilation (ASP.NET Settings Schema)](https://msdn.microsoft.com/library/40fa889d-5412-487a-b6a9-21eb011c2384). |
34 | 34 |
|
35 | 35 | To implement a build provider that generates source code for a custom file type, derive a class from <xref:System.Web.Compilation.BuildProvider>, and override the <xref:System.Web.Compilation.BuildProvider.GenerateCode%2A> method to generate source code for the supported file type. The generated source is added to the <xref:System.Web.Compilation.AssemblyBuilder> object in the form of a CodeDOM graph, or as content that represents a physical source code file. If the build provider requires a specific programming language, override the <xref:System.Web.Compilation.BuildProvider.CodeCompilerType%2A> property to return a <xref:System.Web.Compilation.CompilerType> object for the supported programming language. If the build provider does not require a specific programming language, do not override the <xref:System.Web.Compilation.BuildProvider.CodeCompilerType%2A> property; use the base class implementation, which indicates that the build provider can use any .NET Framework language, such as Visual Basic or C#.
|
36 | 36 |
|
|
276 | 276 | ## Remarks
|
277 | 277 | Use the <xref:System.Web.Compilation.BuildProvider.GetDefaultCompilerType%2A> method to examine the default compiler type for a build provider. Use the <xref:System.Web.Compilation.BuildProvider.GetDefaultCompilerTypeForLanguage%2A> method to examine the compiler type configured in a build provider for a specific language name.
|
278 | 278 |
|
279 |
| - The base <xref:System.Web.Compilation.BuildProvider> class determines the default compiler type using the `defaultLanguage` attribute value in the section of the application configuration file. If there is no default language setting in the compilation section, the default compiler type is set using the <xref:Microsoft.VisualBasic.VBCodeProvider> language provider. |
| 279 | + The base <xref:System.Web.Compilation.BuildProvider> class determines the default compiler type using the `defaultLanguage` attribute value in the `compilation` section of the application configuration file. If there is no default language setting in the `compilation` section, the default compiler type is set using the <xref:Microsoft.VisualBasic.VBCodeProvider> language provider. |
280 | 280 |
|
281 | 281 | When deriving from the <xref:System.Web.Compilation.BuildProvider> class, you can use <xref:System.Web.Compilation.BuildProvider.GetDefaultCompilerType%2A> to set the <xref:System.Web.Compilation.BuildProvider.CodeCompilerType%2A> property within your implementation.
|
282 | 282 |
|
|
315 | 315 | ## Remarks
|
316 | 316 | Use the <xref:System.Web.Compilation.BuildProvider.GetDefaultCompilerTypeForLanguage%2A> method to examine the compiler type configured in the build provider for a specific language name. Use the <xref:System.Web.Compilation.BuildProvider.GetDefaultCompilerType%2A> method to examine the default compiler type for a build provider.
|
317 | 317 |
|
318 |
| - The base <xref:System.Web.Compilation.BuildProvider> class determines the default compiler type using the <xref:System.Web.Configuration.Compiler> elements in the <xref:System.Web.Configuration.CompilationSection.Compilers%2A> property of the <xref:System.Web.Configuration.CompilationSection> object for the configuration file. This is equivalent to examining the elements in the and the elements in the sections of the configuration file. For example, for the `language` value VB, the base class method returns a <xref:System.Web.Compilation.CompilerType> object that corresponds to the configured settings for an instance of <xref:Microsoft.VisualBasic.VBCodeProvider?displayProperty=nameWithType>. |
| 318 | + The base <xref:System.Web.Compilation.BuildProvider> class determines the default compiler type using the <xref:System.Web.Configuration.Compiler> elements in the <xref:System.Web.Configuration.CompilationSection.Compilers%2A> property of the <xref:System.Web.Configuration.CompilationSection> object for the configuration file. This is equivalent to examining the `buildProviders` elements and the `compiler` elements in the `compilers` sections of the configuration file. For example, for the `language` value `VB`, the base class method returns a <xref:System.Web.Compilation.CompilerType> object that corresponds to the configured settings for an instance of <xref:Microsoft.VisualBasic.VBCodeProvider?displayProperty=nameWithType>. |
319 | 319 |
|
320 | 320 | When you derive from the <xref:System.Web.Compilation.BuildProvider> class, you can use <xref:System.Web.Compilation.BuildProvider.GetDefaultCompilerTypeForLanguage%2A> to set the <xref:System.Web.Compilation.BuildProvider.CodeCompilerType%2A> property value for the language supported by your implementation.
|
321 | 321 |
|
|
626 | 626 | <format type="text/markdown"><![CDATA[
|
627 | 627 |
|
628 | 628 | ## Remarks
|
629 |
| - The ASP.NET build environment initializes the collection of assemblies that are available for reference by the build provider. The source code generated by a build provider can use public types in the referenced assemblies. The referenced assembly collection consists of other assemblies built in the ASP.NET application, and assemblies listed in the element in the configuration file. |
| 629 | + The ASP.NET build environment initializes the collection of assemblies that are available for reference by the build provider. The source code generated by a build provider can use public types in the referenced assemblies. The referenced assembly collection consists of other assemblies built in the ASP.NET application, and assemblies listed in the `assemblies` element in the configuration file. |
630 | 630 |
|
631 | 631 | If the build provider generates source code that references additional assemblies, the build provider adds the additional assemblies using the <xref:System.Web.Compilation.AssemblyBuilder.AddAssemblyReference%2A> method. The ASP.NET build environment resolves external types during assembly compilation using both the referenced assemblies added by build providers and the default collection of assemblies available for reference.
|
632 | 632 |
|
|
0 commit comments