• InProcess Side by Side (Part2)


    Another In-process SxS ariticle from CLRTeam Luiz Fernando Santos, main introduce the common scenario of In-Process SxS.

    Article link: http://blogs.msdn.com/clrteam/archive/2009/06/07/in-process-side-by-side-part-2-common-in-proc-sxs-scenarios.aspx

    Content from CLRTeam:

     

    This section covers the most common in-process side by side scenarios. The scenarios cover which CLR is used to run the specific code, given a particular machine configuration. 

    Native Application calling Managed COM Components

    Machine Configuration:  Both CLR 2.0 (.NET v2.0, v3.5 or v3.5) and CLR 4 installed

    In this scenario, all Legacy Managed COM Components will execute against CLR 2.0 and any call to the Global Hosting APIs, in the whole process (in the application or any assembly activated through COM or legacy API), will return CLR 2.0 results.  Also, any activated Managed COM Components compiled against CLR 4 will execute against CLR 4, in-process side by side with others, compiled against CLR 2.0 (executed against CLR 2.0).

    Native Application calling the legacy Global Hosting APIs

    Machine Configuration:  Both CLR 2.0 (.NET v2.0, v3.5 or v3.5)  and CLR 4 installed

    In this scenario, any call to these functions, in the whole process (in the application or any assembly activated through COM or legacy API), will return CLR 2.0 results.

    Managed Application compiled against v4 calling Managed COM components

    Machine Configuration:  Both CLR 2.0 (.NET v2.0, v3.5 or v3.5)  and CLR 4 installed

    In this scenario, a managed application compiled against CLR 4 calls a managed COM component compiled against CLR v1.x, CLR v2.0 or CLR 4.  In this situation, any call to the Global Hosting APIs, in the whole process (in the application or any assembly activated through COM or legacy API), will return CLR 4 results.  Also, any activated legacy Managed COM Components will execute against CLR 4.

    Managed Application compiled against v4 using P/Invokes to call the legacy Global Hosting APIs

    Machine Configuration:  Both CLR 2.0 (.NET v2.0, v3 or v3.5) and CLR 4 installed

    In this scenario, a managed application compiled against v4 uses P/Invoke to call the existing legacy Global Hosting APIs.  In this situation, any call to these functions, in the whole process (in the application or any assembly activated through COM or legacy API), will return CLR 4 results.

    Managed Application compiled against v2 calling Managed COM components compiled against CLR 4

    Machine Configuration:  Both CLR 2.0 (.NET v2.0, v3.0 or v3.5) and CLR 4 installed

    In this scenario, a managed application compiled against CLR 2.0 calls a managed COM component compiled against CLR 4.  In this scenario, any activated Managed COM Components will execute against CLR 4 in-process side by side with CLR 2.0.

    What are the most common non-default scenarios?

    This section illustrates some common scenarios and the corresponding configuration file entries in order to get the right results.

    Native Application rolling forward all its Managed COM Components to CLR 4

    Machine Configuration:  CLR 4 installed (other CLRs can be installed also, but in this case, this is irrelevant)

    In this scenario, a native application needs to activate all its managed COM components (independently of the CLR version they were compiled against) using CLR 4.  In this situation, an APP.CONFIG file needs to be included in the same directory of the native application (EXE) with the following entry:

    <startup>

    <process>

    <rollForward enabled="true" />

    </process>

    </startup>

    This configuration will force all Managed COM Components to execute against CLR 4.

    Native Application using legacy Global Hosting APIs to return CLR 4 results

    Machine Configuration:  .NET 4 installed (other CLRs can be installed also, but in this case, this is irrelevant)

    In this scenario, a native application uses the existing Global Hosting APIs to return CLR 4 results.  To accomplish that, an APP.CONFIG file needs to be included in the same directory of the native application with the following entry:

    <startup>

    <process>

    <rollForward enabled="true" />

    </process>

    </startup>

    This configuration will force all Managed COM Components to execute against CLR 4.  It's important to note that some Global Hosting APIs may not be affected by the APP.CONFIG file above.

    Managed Application compiled against v2 rolling forward to execute against CLR 4

    Machine Configuration:  .NET 4 installed (other CLRs can be installed also, but in this case, this is irrelevant)

    In this scenario, a managed application compiled against v2.0 needs to execute against CLR 4.  In this situation, an APP.CONFIG file needs to be included in the same directory of the managed application (EXE) with the following entry.

    <startup>

    <supportedRuntime version="v4.0.XXXX" />

    </startup>

    Where XXXXX is the CLR build number.  In this situation, any Managed COM Component activated by this application will also roll forward to CLR 4.  Also, any Global Hosting API call in the whole process (in the application or in any of the Managed COM components) will return CLR 4 results (for example, CorBindToRuntime(pwszVersion=NULL) or GetCORSystemDirectory).

    Managed Application compiled against v4 turning on In-process Side By Side

    Machine Configuration:  Both CLR 2.0 (.NET v2.0, v3.0 or v3.5) and CLR 4 installed

    In this scenario, a managed application compiled against CLR 4 needs to activate Managed COM Components compiled against CLR 4 side by side with Managed COM Components compiled against CLR 2.0 (or previous version).  In this situation, an APP.CONFIG file needs to be included in the same directory of the managed application (EXE) with the following entry.

    <startup>

    <process>

    <rollForward enabled="false" />

    </process>

    </startup>

    Managed Application compiled against v2 running against v4 and turning on In-process Side By Side

    Machine Configuration:  Both CLR 2.0 (.NET v2.0, v3.5 or v3.5) and CLR 4 installed

    In this scenario, a managed application compiled against CLR 2.0 needs to run against CLR 4 and also needs to activate Managed COM Components compiled against CLR 4 side by side with Managed COM Components compiled against CLR 2.0 (or previous version).  In this situation, an APP.CONFIG file needs to be included in the same directory of the managed application (EXE) with the following entry.

    <startup>

    <supportedRuntime version="v4.0.XXXXX" />

    <supportedRuntime version="v2.0.50727" />

    <process>

    <rollForward enabled="false" />

    </process>

    </startup>

  • 相关阅读:
    setTimeout中0毫秒延时
    javascript中call和apply方法
    javascript闭包
    apns 服务
    新的开始,新的起点
    心情笔记
    如何解决控件附件上传时超大附件无法上传的问题
    BPM实例分享——日期自动计算
    BPM实例分享——金额规则大写
    分享一个程序猿在流程数据查看权限问题的总结
  • 原文地址:https://www.cnblogs.com/holly/p/1628072.html
Copyright © 2020-2023  润新知