<linkedConfiguration> 項目<linkedConfiguration> element

指定要包含的組態檔。Specifies a configuration file to include.

<configuration>
  <assemblyBinding>
    <linkedConfiguration>

語法Syntax

<linkedConfiguration href="URL of linked configuration file" />

屬性Attribute

描述Description
hrefhref 必要屬性。Required attribute.

要包含的設定檔的 URL。The URL of the configuration file to include. Href屬性唯一支援的格式為 file://The only format supported for the href attribute is file://. 支援本機檔案和 UNC 檔案。Local files and UNC files are supported.

父元素Parent element

描述Description
<assemblyBinding> 元素<assemblyBinding> Element 指定位於組態層級的組件繫結原則。Specifies assembly binding policy at the configuration level.

子元素Child elements

NoneNone

備註Remarks

<linkedConfiguration> 元素會簡化元件元件的服務。The <linkedConfiguration> element simplifies servicing for component assemblies. 如果一或多個應用程式使用的元件具有位於已知位置的設定檔,則使用該元件之應用程式的設定檔案可以使用 <linkedConfiguration> 元素來包含元件設定檔,而不是直接包含設定資訊。If one or more applications use an assembly that has a configuration file residing in a well-known location, the configuration files of the applications that use the assembly can use the <linkedConfiguration> element to include the assembly configuration file, rather than including configuration information directly. 服務元件元件時,更新通用設定檔案會將更新的設定資訊提供給所有使用該元件的應用程式。When the component assembly is serviced, updating the common configuration file provides updated configuration information to all applications that use the assembly.

注意

<linkedConfiguration> 具有 Windows 並存資訊清單的應用程式不支援元素。The <linkedConfiguration> element is not supported for applications with Windows side-by-side manifests.

下列規則會管理連結的設定檔使用:The following rules govern the use of linked configuration files:

  • 包含的設定檔案中的設定只會影響載入器系結原則,而且僅供載入器使用。The settings in included configuration files only affect loader binding policy and are used only by the loader. 包含的設定檔案可以具有系結原則以外的設定,但這些設定不會有任何作用。The included configuration files can have settings other than binding policies, but those settings don't have any effect.

  • 屬性唯一支援的格式 hreffile://The only format supported for the href attribute is file://. 支援本機檔案和 UNC 檔案。Local files and UNC files are supported.

  • 每個設定檔的連結設定數目沒有條件約束。There is no constraint on the number of linked configurations per configuration file.

  • 所有連結的設定檔都會合並成一個檔案,類似于 #include C/c + + 中指示詞的行為。All linked configuration files are merged to form one file, similar to the behavior of the #include directive in C/C++.

  • <linkedConfiguration> 只有在應用程式佈建檔中才允許此元素; machine.config中會忽略此專案。The <linkedConfiguration> element is allowed only in application configuration files; it's ignored in Machine.config.

  • 偵測到迴圈參考並結束。Circular references are detected and terminated. 也就是說,如果 <linkedConfiguration> 一系列的設定檔元素形成迴圈,就會偵測到迴圈並停止。That is, if the <linkedConfiguration> elements of a series of configuration files form a loop, the loop is detected and stopped.

範例Example

下列範例顯示如何包含本機硬碟的設定檔:The following example shows how to include configuration file from the local hard disk:

<configuration>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <linkedConfiguration href="file://c:\Program Files\Contoso\sharedConfig.xml"/>
  </assemblyBinding>
</configuration>

另請參閱See also