Udostępnij za pośrednictwem


assemblies Element for compilation (ASP.NET Settings Schema)

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

<configuration> Element
  system.web Element (ASP.NET Settings Schema)
    compilation Element (ASP.NET Settings Schema)
      assemblies Element for compilation (ASP.NET Settings Schema)

<assemblies> 
   <add />
   <clear/>
   <remove />
</assemblies>

Attributes and Elements

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

Attributes

None.

Child Elements

Subtag

Description

add

Optional element.

Adds an assembly reference to the collection.

clear

Optional element.

Removes all references to inherited assembly names, allowing only the references that are added by the current add element.

remove

Optional element.

Removes a reference to an inherited assembly name from the collection.

Parent Elements

Element

Description

configuration

Specifies 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 the compilation settings that ASP.NET uses to compile applications.

Remarks

The assemblies element defines a collection of assembly names that are used during compilation of an ASP.NET application.

Default Configuration

The following default assemblies element is not explicitly configured in the Machine.config file or in the root Web.config file. However, it is the default configuration that is returned by the application. Items are added to the assemblies collection in the root Web.config file.

<assemblies>
   <clear />
</assemblies>

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>

Example

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>

Element Information

Configuration section handler

CompilationSection

Configuration Member

Assemblies

AssemblyCollection

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) 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

See Also

Tasks

How to: Configure Specific Directories Using Location Settings

How to: Lock ASP.NET Configuration Settings

Reference

compilation Element (ASP.NET Settings Schema)

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

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

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

buildProviders Element for compilation (ASP.NET Settings Schema)

codeSubDirectories Element for compilation (ASP.NET Settings Schema)

compilers Element for compilation (ASP.NET Settings Schema)

expressionBuilders Element for compilation (ASP.NET Settings Schema)

configuration Element (General Settings Schema)

system.web Element (ASP.NET Settings Schema)

System.Configuration

System.Web.Configuration

CompilationSection

Assemblies

AssemblyCollection

Concepts

ASP.NET Compilation Overview

ASP.NET Web Page Syntax Overview

ASP.NET Configuration File Hierarchy and Inheritance

Securing ASP.NET Configuration

ASP.NET Configuration Scenarios

Other Resources

General Configuration Settings (ASP.NET)

ASP.NET Configuration Settings

ASP.NET Web Site Administration

ASP.NET Configuration Files

ASP.NET Configuration API