Adds an assembly that is referenced by source code generated for a file.
Assembly: System.Web (in System.Web.dll)
A BuildProvider implementation uses the method when generating source code that references types within the input assembly.
The ASP.NET build environment initializes the default collection of assemblies available for reference through the build provider in the BuildProvider.ReferencedAssemblies property. If the build provider generates source code that references additional assemblies, the build provider adds the additional assemblies using the 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.
Typically, a BuildProvider object adds source code to the AssemblyBuilder object in the GenerateCode method. If a build provider generates source code that uses an external type, the build provider adds the type's assembly using the method.
Use the method to add a referenced assembly required in source code generated by a BuildProvider instance for a specific file type. Use the assemblies Element for compilation (ASP.NET Settings Schema) configuration element to configure an assembly for reference across multiple file types in a project.