@ Assembly
Links an assembly to an ASP.NET application file (such as a Web page, a user control, a master page, or a Global.asax file) during compilation, making all the assembly's classes and interfaces available for use.
<%@ Assembly Name="assemblyname" %>
<%@ Assembly Src="pathname" %>
Attributes
Name
A string that represents the name of the assembly to link.Note The assembly name does not include a file name extension.
Src
The path to a source file to dynamically compile and link against.Note You must include either a Name or a Src attribute in an @ Assembly directive, but you cannot include both within the same directive. If you need to use both of these attributes, you must include multiple @ Assembly directives in the file.
Remarks
The compiler references the assembly at compile time, allowing early binding. After compilation of the requested ASP.NET file is complete, the assembly is loaded into the application domain, allowing late binding. The @ Assembly directive can be used in .aspx pages, .ascx files, .master pages and .asax files.
Assemblies that reside in your Web application's \Bin directory are automatically linked to ASP.NET files within that application. Such assemblies do not require the @ Assembly directive. You can disable this functionality by removing the following line from the <assemblies> section of your application's Web.config file:
<add assembly="*"/>
As an alternative to using the @ Assembly directive, you can use the Web.config file to link assemblies across an entire application. For more information about the Web.config file and configuring your application, see ASP.NET Configuration Overview and assemblies Element for compilation (ASP.NET Settings Schema).
Example
The following code example uses two @ Assembly directives, the first to link to MyAssembly
, a user-defined assembly, and the second to MySource.vb
, a Visual Basic source file.
<%@ Assembly Name="MyAssembly" %>
<%@ Assembly Src="MySource.vb" %>
See Also
Reference
Directive Syntax
assemblies Element for compilation (ASP.NET Settings Schema)