Parameters

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.