1

I'm using ASP.NET MVC3, StructureMap and SharpSvn.
Here's the code that I'm using:

public class SvnFileReader : ISvnFileReader
{
    private readonly string _svnAddress;

    public SvnFileReader(string svnAddress)
    {
        _svnAddress = svnAddress;
    }

    public void DownloadFiles(DirectoryInfo destination)
    {
        using (var svnClient = new SvnClient())
        {
            // checkout the code to the specified directory
            svnClient.CheckOut(new Uri(_svnAddress), destination.FullName);
        }
    }
}

When I execute this code:

_svnFileReader.DownloadFiles(new System.IO.DirectoryInfo(@"d:\test"));

I get the following error message:

Could not load file or assembly 'file:///D:\Projects\SvnFileReaderDemo\bin\SharpSvn-DB44-20-Win32.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

Any help would be greatly appreciated!

abatishchev
  • 98,240
  • 88
  • 296
  • 433
šljaker
  • 7,294
  • 14
  • 46
  • 80

1 Answers1

1

You should exclude the SharpSvn DLLs from StructureMap automatic assembly scanning for dependencies. This is an unmanaged library but because you have configured StructureMap to look for types in all dlls when it tries to load this one it breaks.


UPDATE:

If you are running this code on a x64 bit OS you may try downloading the specific x64 SharpSvn which uses SharpSvn-DB44-20-x64.dll.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • Could you please tell me how can I do that? – šljaker Jun 30 '11 at 14:37
  • @šljaker, I don't know what code you have used to configure your DI container. – Darin Dimitrov Jun 30 '11 at 14:38
  • @šljaker, are you running this on x86 or x64 bit OS? – Darin Dimitrov Jun 30 '11 at 15:04
  • @šljaker, why are you using the Win32 library then? You need to download the x64 bit version of SharpSvn. There are two different downloads and NuGet packages. – Darin Dimitrov Jun 30 '11 at 15:28
  • @Darin, I tried to install both NuGet packages but I always get the error message. For x84: 'Failed to add reference to SharpSvn-DB44-20-win32' and for x64: 'Failed to add reference to SharpSvn-DB44-20-x64'. That's way I tried to reference SharpSvn manually. – šljaker Jun 30 '11 at 18:21
  • The SharpSVN-DB44-*.dll is only needed if you want to access file:/// repositories that use the BDB repository format. (SharpSvn was designed to handle the case where that file is missing: you just get a proper exception when you try to open such a repository). – Bert Huijben Jul 02 '11 at 20:00