BuildProvider.GenerateCode Method (AssemblyBuilder)

 

Generates source code for the virtual path of the build provider, and adds the source code to a specified assembly builder.

Namespace:   System.Web.Compilation
Assembly:  System.Web (in System.Web.dll)

abstract GenerateCode : 
        assemblyBuilder:AssemblyBuilder -> unit
override GenerateCode : 
        assemblyBuilder:AssemblyBuilder -> unit

Parameters

assemblyBuilder
Type: System.Web.Compilation.AssemblyBuilder

The assembly builder that references the source code generated by the build provider.

To implement a build provider that generates source code for a custom file type, derive a class from the BuildProvider class, and override the GenerateCode method to generate source code for the supported file type.

Typically, a build provider's GenerateCode implementation reads the VirtualPath property, parses the contents, and adds the generated source code to the specified AssemblyBuilder object. You can contribute source code to the assembly in the form of a TextWriter object or a CodeDOM graph. To add source code to the assembly through a TextWriter object, use the CreateCodeFile method. To add source code in a CodeDOM graph to the assembly, use the AddCodeCompileUnit method.

If the build provider generates source code in a specific programming language, you must override the CodeCompilerType property to return a CompilerType object for the supported programming language.

The following code example illustrates a simple build provider implementation, inheriting from the abstract BuildProvider base class. The build provider overrides the CodeCompilerType, GetGeneratedType, and GenerateCode members of the base class.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: