none
Assembly Redirection/Probing/Code basing RRS feed

  • Question

  • Hi,

    I have a main application which uses a plugin/class library and this plugin have a reference to some signed dll (which can be just replaced by newer version).

    I have tried putting the code basing under application configuration level:

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="MyLib" publicKeyToken="56b52bb1ff7fb0d5" culture="neutral" />
            <codeBase version="2.0.4472.18473" href="SomeFolder\SomeSubFolder\MyReferencedAssembly.dll"/>
          </dependentAssembly>
        </assemblyBinding>
      </runtime>

    This works well since application level sees during Assembly loading. The problem is we don't want to put it in application level configuration but we want to put this in Plugin Level configuration...however putting this in plugin level config does not work...

    any other way to let CLR discover this probing on plugin configuration level?

    (The goal is the user can just copy paste new version to the plugin subfolder and we can just give user a document on how to add it in the configuration item such as assemblyIdentity, bindingRedirect etc.. needed by the user to configure)...

    Other constraint, we cannot use GAC as it will just adds up several version registered for one assembly.

    Thanks



    • Edited by Fritz Jeran Thursday, October 11, 2012 7:12 AM
    Thursday, October 11, 2012 2:34 AM

Answers

  • Hi Fritz,

    How about this suggestion?

    http://stackoverflow.com/questions/4454016/multiple-app-config-files-in-net-class-library-project 

    The app will use the config file named YourExcecutable.exe.config which is by default the file App.config included in your (executable) project. Note, that .NET only loads one config file for the whole application. You cannot use multiple configuration files (i.e. one per library project) without coding.

    1. Option: You can use postbuild events and different solution configurations to copy one or another App.Config file to the output folder

    2. Option: You can use the ConfigurationManager Class to load an alternate config file by code.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, October 11, 2012 11:27 AM
    Moderator