Export (0) Print
Expand All

add Element for assemblies for compilation (ASP.NET Settings Schema)

Adds an assembly reference to the collection.

<configuration> Element
  system.web Element (ASP.NET Settings Schema)
    compilation Element (ASP.NET Settings Schema)
      assemblies Element for compilation (ASP.NET Settings Schema)
        add Element for assemblies for compilation (ASP.NET Settings Schema)
<add 
   assembly="Assembly 
             [,Version=version number] 
             [,Culture=culture] 
             [,PublicKeyToken=token]"
/>

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute

Description

assembly

Required String attribute.

Specifies a comma-separated assembly combination consisting of version, culture, and public key tokens. ASP.NET searches for the assembly DLL first in the private Bin directory for the application, and then in the system assembly cache.

Child Elements

None.

Parent Elements

Element

Description

configuration

The root element in every configuration file that is used by the common language runtime and the .NET Framework applications.

system.web

Specifies the root element for the ASP.NET configuration section.

compilation

Configures all compilation settings that ASP.NET uses to compile applications.

assemblies

Defines a collection of names of assemblies that are used during compilation of an ASP.NET application.

The add element adds an assembly reference to use during compilation of a dynamic resource. ASP.NET automatically links this assembly to the resource when compiling each code module.

The value of the add element is an assembly name, not a DLL path. ASP.NET looks up the assembly name to find its physical DLL location. Optionally, you can specify the asterisk (*) wildcard character to add every assembly within the private assembly cache for the application, which is located either in the \bin subdirectory of an application or in the.NET Framework installation directory (%systemroot%\Microsoft.NET\Framework\version\). For detailed information, see Load.

Default Configuration

The following default assemblies element is configured in the root Web.config file.

<assemblies>
    <add assembly="mscorlib" />
    <add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <add assembly="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <add assembly="System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <add assembly="System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <add assembly="*" />
</assemblies>

The following code example demonstrates how to add an assembly reference to an application.

<configuration>
   <system.web>
      <compilation>
         <assemblies>
            <add assembly="System.Data, Version=1.0.2411.0, 
                           Culture=neutral, 
                           PublicKeyToken=b77a5c561934e089"/>
         </assemblies>
      </compilation>
   </system.web>
</configuration>

Configuration section handler

CompilationSection

Configuration member

Add

Configurable locations

Machine.config

Root-level Web.config

Application-level Web.config

Virtual or physical directory–level Web.config

Requirements

Microsoft Internet Information Services (IIS) version 5.0, 5.1, or 6.0

The .NET Framework version 1.0, 1.1, or 2.0

Microsoft Visual Studio 2003 or Visual Studio 2005

Community Additions

ADD
Show:
© 2014 Microsoft