<Relativebindforresources> > 元素<relativeBindForResources> Element

最佳化附屬組件的探查。Optimizes the probe for satellite assemblies.

<configuration> <configuration>
    <runtime >   <runtime>
     <relativebindforresources> >    <relativeBindForResources>

語法Syntax

<relativeBindForResources    
   enabled="true|false" />  

屬性和項目Attributes and Elements

下列各節描述屬性、子項目和父項目。The following sections describe attributes, child elements, and parent elements.

屬性Attributes

屬性Attribute 描述Description
enabled 必要屬性。Required attribute.

指定通用語言執行時間是否要優化附屬元件的探查。Specifies whether the common language runtime optimizes the probe for satellite assemblies.

啟用屬性enabled Attribute

Value 描述Description
false 執行時間不會優化附屬元件的探查。The runtime does not optimize the probe for satellite assemblies. 此為預設值。This is the default value.
true 執行時間會優化附屬元件的探查。The runtime optimizes the probe for satellite assemblies.

子項目Child Elements

無。None.

父項目Parent Elements

項目Element 描述Description
configuration 通用語言執行平台和 .NET Framework 應用程式所使用之每個組態檔中的根項目。The root element in every configuration file used by the common language runtime and .NET Framework applications.
runtime 包含有關執行階段初始化選項的資訊。Contains information about runtime initialization options.

備註Remarks

一般來說,Resource Manager 會探查資源,如封裝和部署資源主題中所述。In general, Resource Manager probes for resources, as documented in the Packaging and Deploying Resources topic. 這表示當 Resource Manager 探查特定當地語系化版本的資源時,它可能會查看全域組件快取、在應用程式的程式碼基底中尋找特定文化特性的資料夾、針對附屬元件查詢 Windows Installer,然後引發AppDomain.AssemblyResolve 事件。This means that when Resource Manager probes for a particular localized version of a resource, it may look in the global assembly cache, look in a culture-specific folder in the application's code base, query Windows Installer for satellite assemblies, and raise the AppDomain.AssemblyResolve event. <relativeBindForResources> 元素會優化 Resource Manager 探查附屬元件的方式。The <relativeBindForResources> element optimizes the way in which Resource Manager probes for satellite assemblies. 在下列情況下探查資源時,它可以改善效能:It can improve performance when probing for resources under the following conditions:

  • 當附屬元件部署在與程式碼元件相同的位置時。When the satellite assembly is deployed in the same location as the code assembly. 換句話說,如果程式碼元件安裝在全域組件快取中,則也必須在該處安裝附屬元件。In other words, if the code assembly is installed in the global assembly cache, the satellite assemblies must also be installed there. 如果程式碼元件安裝在應用程式的程式碼基底中,則附屬元件也必須安裝在程式碼基底中的文化特性特定資料夾內。If the code assembly is installed in the application's code base, the satellite assemblies must also be installed in a culture-specific folder in the code base.

  • 未使用 Windows Installer,或只是很少用來視需要安裝附屬元件。When Windows Installer is not used or is used only rarely for on-demand installation of satellite assemblies.

  • 當應用程式代碼未處理 AppDomain.AssemblyResolve 事件時。When application code does not handle the AppDomain.AssemblyResolve event.

<relativeBindForResources> 元素的 enabled 屬性設定為 true 會將附屬元件的 Resource Manager 探查優化,如下所示:Setting the enabled attribute of the <relativeBindForResources> element to true optimizes Resource Manager's probe for satellite assemblies as follows:

  • 它會使用父程式碼元件的位置來探查附屬元件。It uses the location of the parent code assembly to probe for the satellite assembly.

  • 它不會查詢附屬元件 Windows Installer。It does not query Windows Installer for satellite assemblies.

  • 它不會引發 AppDomain.AssemblyResolve 事件。It does not raise the AppDomain.AssemblyResolve event.

請參閱See also