AssemblyBuilder Class
Provides a container for building an assembly from one or more virtual paths within an ASP.NET project.
Assembly: System.Web (in System.Web.dll)
The AssemblyBuilder type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | AddAssemblyReference | Adds an assembly that is referenced by source code generated for a file. |
![]() | AddCodeCompileUnit | Adds source code for the assembly in the form of a CodeDOM graph. |
![]() | CreateCodeFile | Allows a build provider to create a temporary source file, and include the source file in the assembly compilation. |
![]() | CreateEmbeddedResource | Allows a build provider to create a resource file to include in the assembly compilation. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GenerateTypeFactory | Inserts a fast object factory template for a type into the compiled assembly. |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetTempFilePhysicalPath | Generates a temporary file path. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Instances of the AssemblyBuilder class are used with BuildProvider class methods to build one or more files into a compiled assembly.
The BuildProvider class defines build functionality for individual files, and the AssemblyBuilder class combines the source code contributed by each BuildProvider instance into a single assembly. The ASP.NET build environment passes an AssemblyBuilder object to the BuildProvider methods when building an assembly from one or more files, so that each BuildProvider instance can contribute source code for its file to the overall assembly.
The ASP.NET build environment determines the language and compiler required by files within the project, based on the BuildProvider::CodeCompilerType property. The build environment groups files based on their compiler settings and builds an assembly from files that require the same compiler.
The CodeDomProvider property indicates the CodeDomProvider implementation that the ASP.NET build environment uses to compile an assembly from the source code contributed by each BuildProvider implementation.
A BuildProvider object contributes source code in the form of a CodeDOM graph using the AddCodeCompileUnit method. A BuildProvider object contributes source code stored in a physical file using the CreateCodeFile method.
After each BuildProvider object contributes source code using the appropriate AssemblyBuilder methods, the ASP.NET build environment uses the AssemblyBuilder class to compile the collected source code into an assembly.
| Topic | Location |
|---|---|
| How To: Secure an ASP.NET Application on a Shared Server | Building ASP .NET Web Applications |
| How To: Secure an ASP.NET Application on a Shared Server | Building ASP .NET Web Applications |
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.
In the GenerateCode method implementation, the build provider adds the generated code for the assembly compilation using the CreateCodeFile method. The example does not include the implementation of the SampleClassGenerator class. For more information, see CodeCompileUnit.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.


