locked
Could not load file or assembly 'XXX.resources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) RRS feed

  • Question

  • Hi,

    I am getting this error while loading resource dictionary from setallite. This is how I am setting resources.

    ResourceDictionary cultureDict = new ResourceDictionary();
    cultureDict.Source = cultureDictionaryUri;

    I have looked for dependencies. There is nothing missing.

    My question: How could I resolve this?

    Interesting fact: cultureDictionaryUri show the correct Culture in it path. but the error message has Culture=neutral in it. why is that?

    Will appreciate any help.

    Thanks.

    Friday, October 19, 2012 3:17 PM

Answers

All replies

    • Proposed as answer by murtazagandhi Friday, October 19, 2012 5:45 PM
    Friday, October 19, 2012 5:44 PM
  • Unfortuantely this didn't work for me.
    Friday, October 19, 2012 6:23 PM
  • The fusionlog when debugged is as follows.

    Strangely enough the paths in this log are incorrect, despite correct path in URI.

    The correct path is file:///E:/Sample Projects/MyProject/MyProject/bin/Debug/de-DE/MyProject.resources.DLL. Note that the folder "de-DE" is just not the there in the log. So somewhere the path is getting messed up. Any thoughts why is that and is this the reason of problem?

    === Pre-bind state information ===
    LOG: User = xxx\xxxx
    LOG: DisplayName = LocalizationTest.resources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
     (Fully-specified)
    LOG: Appbase = file:///E:/Sample Projects/MyProject/MyProject/bin/Debug/
    LOG: Initial PrivatePath = NULL
    Calling assembly : PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
    ===
    LOG: This bind starts in default load context.
    LOG: No application configuration file found.
    LOG: Using host configuration file:
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Attempting download of new URL file:///E:/Sample Projects/MyProject/MyProject/bin/Debug/MyProject.resources.DLL.
    WRN: Comparing the assembly name resulted in the mismatch: CULTURE
    ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

    Friday, October 19, 2012 7:02 PM
  • Hi,

    As i see it is the debug directory that is still

    referred.

    So is the application deployed?

    What is the mode in which you test the application?

    Release/Debug

    Thanks,

    Regards.

    Saturday, October 20, 2012 6:31 AM
  • Additional, if this thread is helpful for this issue:

    http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/382149c7-3801-4937-a954-1f2c092b8cf6/


    Sheldon _Xiao[MSFT]
    MSDN Community Support | Feedback to us
    Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 22, 2012 6:49 AM
  • Application is not deployed. Its is just a sample app to try localization.

    I test in debug mode.

    • Edited by Dami Monday, October 22, 2012 3:13 PM
    Monday, October 22, 2012 3:10 PM
  • Check that your build configuration is the same for each project. Ie, all projects should be either X86, or all X64, or all Any CPU.
    Tuesday, October 23, 2012 3:17 AM
  • Hi,

    You may want to consider deploying the satellite assembly in the GAC

    after strong naming it

    http://msdn.microsoft.com/en-us/library/21a15yht.aspx

    For now it seems that the path,

    file:///E:/Sample Projects/MyProject/MyProject/bin/Debug/de-DE/MyProject.resources.DLL

    is not being resolved  , or the dll is not being copied to the output directory.

     

     copy to output

     

    Regards.

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by murtazagandhi Tuesday, October 23, 2012 11:59 AM edit
    Tuesday, October 23, 2012 11:58 AM
  • murtazagandhi thank you for your response.

    dlls are generated by lolcbaml and are there. They are not referenced in project as well as they are setallite dlls for localization and for that reason I don't want to put them in  GAC.

    Will be grateful if you can have a look at my sample project at: https://skydrive.live.com/?cid=D4930FB7EEC2C73D&id=D4930FB7EEC2C73D%21177

    Thanks.


    • Edited by Dami Tuesday, October 23, 2012 1:48 PM
    Tuesday, October 23, 2012 1:47 PM
  • I added the subdirectory to probe setallite assembly from it as follows

    AppDomain.CurrentDomain.AppendPrivatePath(culName); (I know its deprecated, i'll replace it with correct call later)

    Now it looks in the correct path. But the error is same. I am wondering why is Culture=neutral in this error as in my setallite assemblies the Culture name is the correct locale i.e., ar-SA or de-DE? Which means that Locbaml generated setallite assembly with incorrect menifest. Any help will be much appreciated.

    Thanks.

    Error:

    LOG: DisplayName = LocalizationTest.resources, Culture=neutral
     (Partial)
    WRN: Partial binding information was supplied for an assembly:
    WRN: Assembly Name: LocalizationTest.resources, Culture=neutral | Domain ID: 1
    WRN: A partial bind occurs when only part of the assembly display name is provided.
    WRN: This might result in the binder loading an incorrect assembly.
    WRN: It is recommended to provide a fully specified textual identity for the assembly,
    WRN: that consists of the simple name, version, culture, and public key token.
    WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
    LOG: Appbase = file:///E:/Sample Projects/MyProject/MyProject/bin/Debug/
    LOG: Initial PrivatePath = ar-SA
    Calling assembly : PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
    ===
    LOG: This bind starts in default load context.
    LOG: No application configuration file found.
    LOG: Using host configuration file:
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Attempting download of new URL file:///E:/Sample Projects/MyProject/MyProject/bin/Debug/MyProject.resources.DLL.
    LOG: Attempting download of new URL file:///E:/Sample Projects/MyProject/MyProject/bin/Debug/MyProject.resources/MyProject.resources.DLL.
    LOG: Attempting download of new URL file:///E:/Sample Projects/MyProject/MyProject/bin/Debug/ar-SA/MyProject.resources.DLL.
    WRN: Comparing the assembly name resulted in the mismatch: CULTURE
    ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.






    • Edited by Dami Tuesday, October 23, 2012 5:27 PM
    Tuesday, October 23, 2012 3:45 PM
  • Hi,

    I have used the

    LocalizeSample solution and had regenerated the error.

    The issue is definitely with the resolving of the Uri .

    public partial class App : Application { public void ApplyCultureDictionary(string assemblyPath, Uri cultureDictionaryUri, string culName) { try { // modified version ResourceDictionary cultureDict = Application.LoadComponent(new Uri("/LocalizeSample."+culName+".xaml", UriKind.Relative)) as ResourceDictionary;

     

    And I have put all the .xaml resource files at the root of the solution.

    It worked

    Regards.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, October 23, 2012 5:29 PM
  • The point is I want to use Locbaml way to localize my app. In reality there would be no culture specific .xaml resource file except for xxxxx.en-US.xaml . So I want to load resources from setallite dlls.

    Please see my last reply.

    Thanks.


    • Edited by Dami Tuesday, October 23, 2012 5:46 PM
    Tuesday, October 23, 2012 5:45 PM
  • The problem is resolved. If anyone wants to see the solution please visit this thread: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/382149c7-3801-4937-a954-1f2c092b8cf6

    Murtaza thank you for looking into this.


    • Marked as answer by Dami Wednesday, October 24, 2012 1:44 PM
    • Edited by Dami Wednesday, October 24, 2012 2:12 PM
    Wednesday, October 24, 2012 1:44 PM