Could not load file or assembly from Program files - W7


  1. Posts : 3
    Windows 7
       #1

    Could not load file or assembly from Program files - W7


    I installed my .Net application in to the Program files on Windows 7 machine. It was working perfectly. One week later i installed(now i have changed my certificate file key and signed my application. So that all assembly public key token value is different now) my application. When i tried to run my application, it threw the error message. " Could not load file or assembly 'microsoft.practices.enterpriselibrary.common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=e7178be946f5d743' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference (Exception from HRESULT:0x80131040)

    Then i look into 'Assembly Binding Log Viewer (Fuslogvw.exe)' . I found the following information

    Code:
     
    ***************************************************************
    *** Assembly Binder Log Entry (1/13/2010 @ 12:39:24 PM) ***
    The operation failed.
    Bind result: hr = 0x80131040. No description available.
    Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
    Running under executable C:\Program Files\MyApplication\MyApplication.exe
    --- A detailed error log follows. 
    === Pre-bind state information ===
    LOG: User = IN\kmanassyed
    LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=e7178be946f5d743
    (Fully-specified)
    LOG: Appbase = file:///C:/Program Files/MyApplication/
    LOG: Initial PrivatePath = NULL
    LOG: Dynamic Base = NULL
    LOG: Cache Base = NULL
    LOG: AppName = MyApplication.exe
    Calling assembly : System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Program Files\MyApplication\MyApplication.exe.config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
    LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=e7178be946f5d743
    LOG: GAC Lookup was unsuccessful.
    LOG: Attempting download of new URL file:///C:/Program Files/MyApplication/Microsoft.Practices.EnterpriseLibrary.Common.DLL.
    LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\MyApplication\Microsoft.Practices.EnterpriseLibrary.Common.dll
    LOG: Entering run-from-source setup phase.
    LOG: Assembly Name is: Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=89dbb42750bb6d3b
    WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
    ERR: The assembly reference did not match the assembly definition found.
    ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
    ***************************************************************
    It says mismatch in Public Key token. Then i later found , my first certificate key value (using which i installed the application very first) to sign my application was "e7178be946f5d743". But now the application signed with the certificate(.pfx) that has key "89dbb42750bb6d3b". CLR Still looks for that e7178be946f5d743 assmeblies. If i install my application that signed with e7178be946f5d743 assembly it works fine. I cant run the application that signed with different key.

    I have to add some interesting points here,

    * If i right click my application.exe and click 'Run as Administrator', It prompts UAC prompt and after click 'yes' it works fine(Though I am admin to the system).

    *My application works fine, If I install the application to any other local folder other than Program files

    *My application works fine, If i turn off UAC

    *Other assemblies like caching , servicemanager etc dlls were binded correctly

    *I searched my whole system. i couldnot find the Microsoft.Practices.EnterpriseLibrary.Common.dll with public key token e7178be946f5d743 anywhere.

    Anybody Advice me Pls. Thanks to read.
    Last edited by Brink; 20 Jan 2010 at 14:34. Reason: code box
      My Computer


  2. Posts : 3
    Windows 7
    Thread Starter
       #2

    Hi guys. It has been fixed. :). I found Virtual Store folder in my local path. It has those old dll and files.
      My Computer


  3. Posts : 3
    Windows 7
    Thread Starter
       #3

    But anybody know, How to protect the files to be written into Virtual store folder. Is there anyway? Please share some knowlege recording Virtual store in W7
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:40.
Find Us