App.config file <bindingRedirect> problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Blum

    App.config file <bindingRedirect> problems

    I have built an assembly (dll) from which I expect third parties to
    subclass. As a result, when my assembly has a version change, it will cause
    any third party assembly based on it to break unless I establish a Publisher
    Policy file. So I have that.

    I have built a Windows app for the same product. This app prompts the user
    for a path to a third party assembly that depends on my assembly. It opens
    the third party assembly (Assembly.Load) and instantiates some of the
    classes it contains. All of this works so long as the versions match between
    my assembly and the third party assembly.

    Instead of demanding that the user adds my assembly and its publisher policy
    file to the GAC, I want my Windows app to offer an application config file
    that handles version changes of my assembly. I cannot get this part to work.
    Any ideas?

    Details:
    My assembly name: PeterBlum.VAM.d ll, v0.9.2.1. Located in the same folder as
    the Windows app. (The publisher policy file and its own config file is also
    in the same folder although that doesn't seem to matter.)
    Third party assembly name: PeterBlum.PDPTo VAM.dll, compiled to use v0.9.2.0.
    Windows app name: Import VAM Classes.exe
    App config file: "Import VAM Classes.exe.con fig" located in the same folder
    as the exe.
    Config file contents:
    <configuratio n>
    <runtime>
    <assemblyBindin g xmlns:asm="urn: schemas-microsoft-com:asm.v1">

    <dependentAssem bly>
    <assemblyIdenti ty name="PeterBlum .VAM"
    publicKeyToken= "76d6c019e89ec3 c9"
    culture=""/>
    <bindingRedirec t oldVersion="0.9 .0.0-0.9.2.0"
    newVersion="0.9 .2.1"/>

    </dependentAssemb ly>
    </assemblyBinding >
    </runtime>
    </configuration>

    The Fusion log entry when Assembly.Load("[path]\PeterBlum.PDPT oVAM.dll") is
    executed:
    The operation failed.
    Bind result: hr = 0x80131040. No description available.

    Assembly manager loaded from:
    C:\WINDOWS\Micr osoft.NET\Frame work\v1.0.3705\ fusion.dll
    Running under executable C:\Program Files\Professio nal Validation And More
    v0.9.2\Support Applications\Im port VAM Classes.exe
    --- A detailed error log follows.

    === Pre-bind state information ===
    LOG: DisplayName = PeterBlum.VAM, Version=0.9.2.0 , Culture=neutral ,
    PublicKeyToken= 76d6c019e89ec3c 9
    (Fully-specified)
    LOG: Appbase = C:\Program Files\Professio nal Validation And More
    v0.9.2\Support Applications\
    LOG: Initial PrivatePath = NULL
    LOG: Dynamic Base = NULL
    LOG: Cache Base = NULL
    LOG: AppName = NULL
    Calling assembly : Import VAM Classes, Version=0.9.2.0 , Culture=neutral ,
    PublicKeyToken= null.
    ===

    LOG: Processing DEVPATH.
    LOG: DEVPATH is not set. Falling through to regular bind.
    LOG: Publisher policy file is not found.
    LOG: Host configuration file not found.
    LOG: Using machine configuration file from
    C:\WINDOWS\Micr osoft.NET\Frame work\v1.0.3705\ config\machine. config.
    LOG: Post-policy reference: PeterBlum.VAM, Version=0.9.2.0 , Culture=neutral ,
    PublicKeyToken= 76d6c019e89ec3c 9
    LOG: Cache Lookup was unsuccessful.
    LOG: Attempting download of new URL file:///C:/Program Files/Professional
    Validation And More v0.9.2/Support Applications/PeterBlum.VAM.D LL.
    LOG: Assembly download was successful. Attempting setup of file: C:\Program
    Files\Professio nal Validation And More v0.9.2\Support
    Applications\Pe terBlum.VAM.DLL
    LOG: Entering run-from-source setup phase.
    WRN: Comparing the assembly name resulted in the mismatch: Revision Number
    ERR: The assembly reference did not match the assembly definition found.
    ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing
    terminated.


    --- Peter Blum

    Email: PLBlum@PeterBlu m.com


  • Yan-Hong Huang[MSFT]

    #2
    RE: App.config file &lt;bindingRedi rect&gt; problems

    Hello Peter,

    I am looking for somebody who could help you on it. Thanks very much.

    Best regards,
    Yanhong Huang
    Microsoft Online Partner Support

    Get Secure! - www.microsoft.com/security
    This posting is provided "AS IS" with no warranties, and confers no rights.

    --------------------
    !From: "Peter Blum" <PLBlum@Blum.in fo>
    !Subject: App.config file <bindingRedirec t> problems
    !Date: Sun, 20 Jul 2003 11:50:26 -0400
    !Lines: 92
    !Organization: www.PeterBlum.com
    !X-Priority: 3
    !X-MSMail-Priority: Normal
    !X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    !X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    !Message-ID: <ewllpatTDHA.22 44@TK2MSFTNGP11 .phx.gbl>
    !Newsgroups: microsoft.publi c.dotnet.genera l
    !NNTP-Posting-Host: h0008021f4212.n e.client2.attbi .com 24.61.166.179
    !Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP11.phx.g bl
    !Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:101869
    !X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    !
    !I have built an assembly (dll) from which I expect third parties to
    !subclass. As a result, when my assembly has a version change, it will cause
    !any third party assembly based on it to break unless I establish a
    Publisher
    !Policy file. So I have that.
    !
    !I have built a Windows app for the same product. This app prompts the user
    !for a path to a third party assembly that depends on my assembly. It opens
    !the third party assembly (Assembly.Load) and instantiates some of the
    !classes it contains. All of this works so long as the versions match
    between
    !my assembly and the third party assembly.
    !
    !Instead of demanding that the user adds my assembly and its publisher
    policy
    !file to the GAC, I want my Windows app to offer an application config file
    !that handles version changes of my assembly. I cannot get this part to
    work.
    !Any ideas?
    !
    !Details:
    !My assembly name: PeterBlum.VAM.d ll, v0.9.2.1. Located in the same folder
    as
    !the Windows app. (The publisher policy file and its own config file is also
    !in the same folder although that doesn't seem to matter.)
    !Third party assembly name: PeterBlum.PDPTo VAM.dll, compiled to use
    v0.9.2.0.
    !Windows app name: Import VAM Classes.exe
    !App config file: "Import VAM Classes.exe.con fig" located in the same folder
    !as the exe.
    !Config file contents:
    !<configuration >
    ! <runtime>
    ! <assemblyBindin g xmlns:asm="urn: schemas-microsoft-com:asm.v1">
    !
    ! <dependentAssem bly>
    ! <assemblyIdenti ty name="PeterBlum .VAM"
    ! publicKeyToken= "76d6c019e89ec3 c9"
    ! culture=""/>
    ! <bindingRedirec t oldVersion="0.9 .0.0-0.9.2.0"
    ! newVersion="0.9 .2.1"/>
    !
    ! </dependentAssemb ly>
    ! </assemblyBinding >
    ! </runtime>
    !</configuration>
    !
    !The Fusion log entry when Assembly.Load("[path]\PeterBlum.PDPT oVAM.dll") is
    !executed:
    !The operation failed.
    !Bind result: hr = 0x80131040. No description available.
    !
    !Assembly manager loaded from:
    !C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.0.3705 \fusion.dll
    !Running under executable C:\Program Files\Professio nal Validation And More
    !v0.9.2\Support Applications\Im port VAM Classes.exe
    !--- A detailed error log follows.
    !
    !=== Pre-bind state information ===
    !LOG: DisplayName = PeterBlum.VAM, Version=0.9.2.0 , Culture=neutral ,
    !PublicKeyToken =76d6c019e89ec3 c9
    ! (Fully-specified)
    !LOG: Appbase = C:\Program Files\Professio nal Validation And More
    !v0.9.2\Support Applications\
    !LOG: Initial PrivatePath = NULL
    !LOG: Dynamic Base = NULL
    !LOG: Cache Base = NULL
    !LOG: AppName = NULL
    !Calling assembly : Import VAM Classes, Version=0.9.2.0 , Culture=neutral ,
    !PublicKeyToken =null.
    !===
    !
    !LOG: Processing DEVPATH.
    !LOG: DEVPATH is not set. Falling through to regular bind.
    !LOG: Publisher policy file is not found.
    !LOG: Host configuration file not found.
    !LOG: Using machine configuration file from
    !C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.0.3705 \config\machine .config.
    !LOG: Post-policy reference: PeterBlum.VAM, Version=0.9.2.0 ,
    Culture=neutral ,
    !PublicKeyToken =76d6c019e89ec3 c9
    !LOG: Cache Lookup was unsuccessful.
    !LOG: Attempting download of new URL file:///C:/Program Files/Professional
    !Validation And More v0.9.2/Support Applications/PeterBlum.VAM.D LL.
    !LOG: Assembly download was successful. Attempting setup of file: C:\Program
    !Files\Professi onal Validation And More v0.9.2\Support
    !Applications\P eterBlum.VAM.DL L
    !LOG: Entering run-from-source setup phase.
    !WRN: Comparing the assembly name resulted in the mismatch: Revision Number
    !ERR: The assembly reference did not match the assembly definition found.
    !ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing
    !terminated.
    !
    !
    !--- Peter Blum
    !www.PeterBlum.com
    !Email: PLBlum@PeterBlu m.com
    !
    !
    !

    Comment

    • Suzanne Cook [MS]

      #3
      Re: App.config file &lt;bindingRedi rect&gt; problems

      If you always want to force your users to use the newest version, you may
      want to consider keeping the assembly version the same and just changing the
      file version, instead. See

      for other things to consider in that decision.

      Suzanne Cook
      My .NET CLR Loader blog: http://blogs.gotdotnet.com/suzcook/
      --
      Please do not respond directly to this alias. This alias is for newsgroup
      purposes only. This posting is provided "AS IS" with no warranties, and
      confers no rights.


      "Peter Blum" <PLBlum@Blum.in fo> wrote in message
      news:ewllpatTDH A.2244@TK2MSFTN GP11.phx.gbl...[color=blue]
      > I have built an assembly (dll) from which I expect third parties to
      > subclass. As a result, when my assembly has a version change, it will[/color]
      cause[color=blue]
      > any third party assembly based on it to break unless I establish a[/color]
      Publisher[color=blue]
      > Policy file. So I have that.
      >
      > I have built a Windows app for the same product. This app prompts the user
      > for a path to a third party assembly that depends on my assembly. It opens
      > the third party assembly (Assembly.Load) and instantiates some of the
      > classes it contains. All of this works so long as the versions match[/color]
      between[color=blue]
      > my assembly and the third party assembly.
      >
      > Instead of demanding that the user adds my assembly and its publisher[/color]
      policy[color=blue]
      > file to the GAC, I want my Windows app to offer an application config file
      > that handles version changes of my assembly. I cannot get this part to[/color]
      work.[color=blue]
      > Any ideas?
      >
      > Details:
      > My assembly name: PeterBlum.VAM.d ll, v0.9.2.1. Located in the same folder[/color]
      as[color=blue]
      > the Windows app. (The publisher policy file and its own config file is[/color]
      also[color=blue]
      > in the same folder although that doesn't seem to matter.)
      > Third party assembly name: PeterBlum.PDPTo VAM.dll, compiled to use[/color]
      v0.9.2.0.[color=blue]
      > Windows app name: Import VAM Classes.exe
      > App config file: "Import VAM Classes.exe.con fig" located in the same[/color]
      folder[color=blue]
      > as the exe.
      > Config file contents:
      > <configuratio n>
      > <runtime>
      > <assemblyBindin g xmlns:asm="urn: schemas-microsoft-com:asm.v1">
      >
      > <dependentAssem bly>
      > <assemblyIdenti ty name="PeterBlum .VAM"
      > publicKeyToken= "76d6c019e89ec3 c9"
      > culture=""/>
      > <bindingRedirec t oldVersion="0.9 .0.0-0.9.2.0"
      > newVersion="0.9 .2.1"/>
      >
      > </dependentAssemb ly>
      > </assemblyBinding >
      > </runtime>
      > </configuration>
      >
      > The Fusion log entry when Assembly.Load("[path]\PeterBlum.PDPT oVAM.dll")[/color]
      is[color=blue]
      > executed:
      > The operation failed.
      > Bind result: hr = 0x80131040. No description available.
      >
      > Assembly manager loaded from:
      > C:\WINDOWS\Micr osoft.NET\Frame work\v1.0.3705\ fusion.dll
      > Running under executable C:\Program Files\Professio nal Validation And[/color]
      More[color=blue]
      > v0.9.2\Support Applications\Im port VAM Classes.exe
      > --- A detailed error log follows.
      >
      > === Pre-bind state information ===
      > LOG: DisplayName = PeterBlum.VAM, Version=0.9.2.0 , Culture=neutral ,
      > PublicKeyToken= 76d6c019e89ec3c 9
      > (Fully-specified)
      > LOG: Appbase = C:\Program Files\Professio nal Validation And More
      > v0.9.2\Support Applications\
      > LOG: Initial PrivatePath = NULL
      > LOG: Dynamic Base = NULL
      > LOG: Cache Base = NULL
      > LOG: AppName = NULL
      > Calling assembly : Import VAM Classes, Version=0.9.2.0 , Culture=neutral ,
      > PublicKeyToken= null.
      > ===
      >
      > LOG: Processing DEVPATH.
      > LOG: DEVPATH is not set. Falling through to regular bind.
      > LOG: Publisher policy file is not found.
      > LOG: Host configuration file not found.
      > LOG: Using machine configuration file from
      > C:\WINDOWS\Micr osoft.NET\Frame work\v1.0.3705\ config\machine. config.
      > LOG: Post-policy reference: PeterBlum.VAM, Version=0.9.2.0 ,[/color]
      Culture=neutral ,[color=blue]
      > PublicKeyToken= 76d6c019e89ec3c 9
      > LOG: Cache Lookup was unsuccessful.
      > LOG: Attempting download of new URL file:///C:/Program Files/Professional
      > Validation And More v0.9.2/Support Applications/PeterBlum.VAM.D LL.
      > LOG: Assembly download was successful. Attempting setup of file:[/color]
      C:\Program[color=blue]
      > Files\Professio nal Validation And More v0.9.2\Support
      > Applications\Pe terBlum.VAM.DLL
      > LOG: Entering run-from-source setup phase.
      > WRN: Comparing the assembly name resulted in the mismatch: Revision Number
      > ERR: The assembly reference did not match the assembly definition found.
      > ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing
      > terminated.
      >
      >
      > --- Peter Blum
      > www.PeterBlum.com
      > Email: PLBlum@PeterBlu m.com
      >
      >[/color]


      Comment

      • Peter Blum

        #4
        Re: App.config file &lt;bindingRedi rect&gt; problems

        Hi Adam and Suzanne,

        Thanks for both of your responses.

        Adam, your idea of using the .Net Configuration Tool was very helpful. I
        generated a file that worked and compared it to the file I posted. The
        difference was the namespace definition.
        I wrote:
        <assemblyBindin g xmlns:asm="urn: schemas-microsoft-com:asm.v1">
        It should have been:
        <assemblyBindin g xmlns="urn:sche mas-microsoft-com:asm.v1">
        I'm not sure where I picked up the "asm" part.

        --- Peter Blum


        "Adam Semel" <asemel@online. microsoft.com> wrote in message
        news:j$5jozVUDH A.1168@cpmsftng xa06.phx.gbl...[color=blue]
        > Hey Peter,
        >
        > Is this an app.config file that you built manually or did you let the
        > net configuration tool build this file for you? I have had some difficulty
        > when building this file myself, only to find that letting the .net
        > configuration tool build it for me not only works, but is much quicker.
        >
        > Let me know if you still have problems.
        >
        >
        >
        > Adam Semel
        > Windows Installer Team
        > Microsoft Developer Support
        >
        > This posting is provided "AS IS" with no warranties, and confers no[/color]
        rights.[color=blue]
        > You assume all risk for your use.
        >
        >
        >
        >
        >[/color]


        Comment

        Working...