none
Platform dependent probing path possible? (x86/x64) RRS feed

  • Question

  • I have a set of assemblies (DLLs) that are platform dependent. A set is for x86 and the other is for x64. The assemblies have the same name and version number. I'd like to compile my application EXE file for "Any CPU" and then dynamically bind to the platform dependent assemblies. Is it possible to somehow configure the app.config file to have different probing paths for the current processor architecture?

    I tried the following, without success:

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <probing privatePath="%PROCESSOR_ARCHITECTURE%"/>
        </assemblyBinding>
      </runtime>
    

    Or is it possible to add private probing paths to the default AppDomain?

    Thanks for any ideas,
    Guido

    Thursday, March 3, 2011 12:38 PM

Answers

  • If your application EXE is "AnyCPU", it will always run only as x64 process on x64 OS. You can install only x64 dependent assemblies in your installer (the x86 binaries will never be used on x64 OS), or you can install the right config file with probing path if you have to keep the directory structure.

    To answer your question: I don't think it is possible to create architecture specific probing path.

    Note: If your application would be a COM object compiled as managed 'Any CPU' DLL, then it can probably run also as x86 process on x64 OS (depends on who activates it). In that case you have to load the dependent assembly dynamically (e.g. via LoadFrom). You could even resolve the dependency dynamically in AssemblyResolve event.

    -Karel

    • Proposed as answer by eryang Monday, March 7, 2011 5:06 AM
    • Marked as answer by Guido Kraus Monday, March 7, 2011 8:09 AM
    Friday, March 4, 2011 4:58 AM
    Moderator

All replies

  • If your application EXE is "AnyCPU", it will always run only as x64 process on x64 OS. You can install only x64 dependent assemblies in your installer (the x86 binaries will never be used on x64 OS), or you can install the right config file with probing path if you have to keep the directory structure.

    To answer your question: I don't think it is possible to create architecture specific probing path.

    Note: If your application would be a COM object compiled as managed 'Any CPU' DLL, then it can probably run also as x86 process on x64 OS (depends on who activates it). In that case you have to load the dependent assembly dynamically (e.g. via LoadFrom). You could even resolve the dependency dynamically in AssemblyResolve event.

    -Karel

    • Proposed as answer by eryang Monday, March 7, 2011 5:06 AM
    • Marked as answer by Guido Kraus Monday, March 7, 2011 8:09 AM
    Friday, March 4, 2011 4:58 AM
    Moderator
  • Hi Guido,

    I'm writing to check the issue status, if you have any update of this issue, please feel free to let us know.


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 7, 2011 5:06 AM