Could not load file or assembly 'SharpSvn' or one of its dependencies. An attempt was made to load a program with an incorrect format
Asked Answered
A

3

9

I just downloaded the 64bit version of the SharpSVN here's the link!

When I run my application, error message displayed. I have searched the net on how to fix this issue but I'm failed. I tried the following solution:

  1. setting the Configuration Manager to x64 as suggested on this post
  2. setting the startup config on this response
  3. also tried downloading x86 and set the config manager to x86.
  4. tried this also, adding assembly link

I'm using Win7, 64bit,.net 4.0.

Alltime answered 12/3, 2013 at 2:58 Comment(3)
Try specifying point 2 like this: <configuration> <startup useLegacyV2RuntimeAc​tivationPolicy="true​"> <supportedRuntime version="v2.0.50727"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /> </startup> </configuration> ?Austro
@SameerSingh there was an error. "Error parsing the web config file"Alltime
@Alltime That's just a copy/paste error. A newline is inserted in your paste where the line breaks in the comment (between c and t in "...RuntimeActivationPolicy..."). :)Bassoon
A
9

Solve it.

  1. Change my platform to x86
  2. Output path to "bin\"
  3. Downloaded the x86 of SharpSVN (1.7008.2243.14245)
  4. Add SharpSVN.dll in GAC.
  5. Delete the bin folder and rebuild solution

This is the link for the explanation.

Alltime answered 14/3, 2013 at 8:17 Comment(3)
You either have to target x86, and use the x86 dll, or target x64 and use the x64 dll (with 2.0 runtime activation policy)Mention
Yep, using the x86 version solved my problem too. Changing the target CPU to x64 when using the x64 version didn't help!Savoyard
But then it re-appeared and it got corrected when I switched back to x64... What the hack!Savoyard
M
5

If you're getting this error when trying to access a website hosted in IIS, you may need to adjust the "Enable 32-Bit Applications" setting in your application pool. See this answer: https://mcmap.net/q/73630/-could-not-load-file-or-assembly-an-attempt-was-made-to-load-a-program-with-an-incorrect-format-system-badimageformatexception

Malleus answered 13/11, 2014 at 14:39 Comment(0)
N
5

This may also come down to a mismatched version of the Microsoft Visual C++ Redistributable Package depending on the version of SharpSvn and the version of Windows/Visual Studio.

Newer versions of SharpSvn have a dependency on the "Microsoft Visual C++ 2010 SP1 Redistributable Package".

x64 - https://www.microsoft.com/en-us/download/details.aspx?id=13523

x86 - https://www.microsoft.com/en-us/download/details.aspx?id=8328

Necropolis answered 31/8, 2016 at 10:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.