none
.NET 4 LocBaml: An attempt was made to load a program with an incorrect format.

    Question

  • I am testing out LocBaml and a simple .NET 4 Wpf program with a button and a label only.

    I add the following to the PropertyGroup in the .csproj file

    <UICulture>en</UICulture>

    Now I open a Visual Studio command promt and build both LocBaml and my test project with msbuild. Then I copy locbaml.exe to the bin\debug of my test project. Then I add uid's to the testproject  by running "msbuild /t:update LocApp1.csproj". Now it is time to generate the csv file by using locbaml. I enter "locbaml /parse en\LocApp1.resources.dll" from the bin\debug folder and hit enter. I get the following error:

    Microsoft (R) Baml Localization Utility 0.0.0.0
    Copyright (C) Microsoft Corporation 2005. All rights reserved.
    
    Could not load file or assembly 'file:///D:\Projects\LocApp1Soln\LocApp1\bin\Debug\en\LocApp1.resources.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
    
    

    What am I doing wrong here? The file is there and ildasm only show a dependency on mscorlib for the satellite assembly.

     Directory of D:\Projects\LocApp1Soln\LocApp1\bin\Debug\en
    
    19.04.2010 22:08       4 608 LocApp1.resources.dll

    I am using VS2010 Professional on Windows 7 64bit.

    Monday, April 19, 2010 8:38 PM

All replies

  • Hi Gammern,

    I did the exact steps described in How to: Localize an Application, and was unable to reproduce the problem you met.

    Can you upload the test project you tried to localize to SkyDrive and paste the link here so I can take a look?

    Meanwhile, since the source code of LocBaml is available, you can also debug it and get more error information out of it.

    Regards,
    Jie
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


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

    If you have any feedback, please tell us.

    The All-In-One Code Framework Project
    My Blog (in Simplified Chinese)
    Wednesday, April 21, 2010 8:08 AM
    Moderator
  • Hi Gammern,

    I am having the same problem as you. I think the problem is related to the fact that you are running on a 64-bit PC. I am also running on Windows 7 64-bit. I found this thread with a suggestion that I am going to try:

    http://stackoverflow.com/questions/41449/i-get-a-an-attempt-was-made-to-load-a-program-with-an-incorrect-format-error-on

    I think it looks suspicious that the LocBaml version is 0.0.0.0. Is this not an official Microsoft tool?

    Regards

    Bo

    Sunday, September 12, 2010 4:04 PM
  • Did we get a resolution for this problem? Running into a similar issue using WPF 4 and windows 7, Visual studio 2010
    • Proposed as answer by bb_bb_bb Saturday, September 17, 2011 7:43 PM
    • Unproposed as answer by bb_bb_bb Saturday, September 17, 2011 7:44 PM
    Thursday, November 18, 2010 8:51 PM
  • I got this to work on Windows 7, 64 bit with VisualStudio 2010, C#. The key for me was the following.

    1. Build your target project AND LocBaml with the same target platform (I used x86 on my Windows 7, 64 bit and it worked fine)

    2. Run LocBaml.exe from the same directory where you target project exe is. So the call to parse will look like this.

    locbaml /parse en-US\MyProject.resources.dll.

    Saturday, September 17, 2011 8:19 PM