无法加载文件或程序集“SharpSvn-DB44-20-Win32.dll”
我正在使用 ASP.NET MVC3、StructureMap 和 SharpSvn。
这是我正在使用的代码:
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);
}
}
}
当我执行此代码时:
_svnFileReader.DownloadFiles(new System.IO.DirectoryInfo(@"d:\test"));
我收到以下错误消息:
无法加载文件或程序集 '文件:///D:\Projects\SvnFileReaderDemo\bin\SharpSvn-DB44-20-Win32.dll' 或其依赖项之一。该模块 预计将包含一个集会 明显。
任何帮助将不胜感激!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该从 StructureMap 自动程序集扫描中排除 SharpSvn DLL 的依赖项。这是一个非托管库,但因为您已将 StructureMap 配置为在所有 dll 中查找类型,所以当它尝试加载此库时,它会中断。更新:
如果您在 x64 位操作系统上运行此代码,您可以尝试下载具体x64 SharpSvn,它使用
SharpSvn-DB44-20-x64.dll
。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
.