9

I downloaded the SharpSVN example they give to try and test it out but I get this error when I try and run it.

System.BadImageFormatException {"Could not load file or assembly 'SharpSvn, Version=1.4999.376.29668, Culture=neutral, PublicKeyToken=d729672594885a28' or one of its dependencies. An attempt was made to load a program with an incorrect format."}

After I downloaded I went to load the project, did the requested conversion with no errors then just tried to run it. Haven't been able to find a solution online.

Running on 64-bit W7 and I notice all the .dlls and other files are all _32, not sure if that is the problem.

Sam F
  • 621
  • 1
  • 8
  • 16

3 Answers3

13

Is the application compiled for x86? If it is compiled for Any CPU, it will be jitted to x64 on a 64-bit system, which leads to this error if it is loading 32-bit DLLs. You have to add an x86 configuration, and build that configuration.

OregonGhost
  • 23,359
  • 7
  • 71
  • 108
  • That was exactly it. I went into the build options and switched it to x86 and now it runs. Thanks a ton :) – Sam F Jun 08 '10 at 16:17
  • If you really need one, you can also download a 64 bit version at the SharpSvn website. – Bert Huijben Jun 28 '10 at 23:24
  • Interesting. What's the next troubleshooting step if using x86 configuration doesn't work (note that esylvestre's suggestion doesn't work in my case too)? – Brian Knoblauch Aug 06 '12 at 19:11
  • @BrianKnoblauch: Do you still get a BadImageFormatException? Then there's likely something wrong with your configuration. Can you load the DLL from a dedicated 32-bit or 64-bit test application? – OregonGhost Aug 15 '12 at 09:59
  • Mine's working now. Unfortunately, for the life of me, I can't remember what I had to do to fix it (I've been bouncing around between so many projects on so many different platforms and languages that I can barely remember my name right now!). Whatever it was I ended up doing, it worked, as I'm not having any problems anymore! :-) – Brian Knoblauch Aug 15 '12 at 12:47
2

It was maybe that you were using the SharpSvn's dll in a .NET 4.0 project. If so, try this in your app.config file:

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
  </startup>
</configuration>
Iain Holder
  • 14,172
  • 10
  • 66
  • 86
esylvestre
  • 1,850
  • 4
  • 21
  • 30
0

my dev environment is 32 bits and our CI build and server is 64 bits . What I ended up.There are two nuget packeges for sharpsvn x86 and x64 ! I installed both of them then I change refrences of srapsvn and sharpsvnUI manually!

Azadeh Khojandi
  • 3,806
  • 1
  • 30
  • 32