2013-11-29 112 views
1

我正在尝试做一个网页,您可以浏览文件夹。我已经在不同的解决方案做到了这一点,它的所有作品,但是当我试图把它与一个以上的项目谁也引用PostSharp解决方案集成我得到这个错误:System.IO.FileNotFoundException:无法加载文件或程序集。系统找不到该文件SharpSvn.dll

Unhandled exception (2.1.7.1, 32 bit, CLR 4.0, Release): System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\_projects\...\Libraries\SharpSvn\SharpSvn.dll' or one of its dependencies. The system cannot find the file specified. 
    File name: 'file:///C:\_projects\...\Libraries\SharpSvn\SharpSvn.dll' 

     at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
     at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) 
     at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) 
     at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) 
     at System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile) 
     at PostSharp.Sdk.CodeModel.ModuleDeclaration.GetSystemModule() 
     at PostSharp.Sdk.CodeModel.Domain.LoadAssembly(Assembly reflectionAssembly, Boolean lazyLoading) 
     at PostSharp.Sdk.CodeModel.Domain.GetAssembly(IAssemblyName assemblyName, BindingOptions bindingOptions) 
     at PostSharp.Sdk.CodeModel.AssemblyRefDeclaration.GetAssemblyEnvelope() 
     at PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.^SgrhoGlQ(AssemblyRefDeclaration _0) 
     at PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.^+GwnKh4ZYHu3() 
     at PostSharp.Sdk.Extensibility.Tasks.MulticastAttributeTask.Execute() 
     at PostSharp.Sdk.Extensibility.Project.ExecutePhase(String phase) 
     at PostSharp.Sdk.Extensibility.Project.Execute() 
     at PostSharp.Hosting.PostSharpObject.ExecuteProjects() 
     at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation) 

    WRN: Assembly binding logging is turned OFF. 
    To enable assembly bind failure logging, set the registry value   [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
    Note: There is some performance penalty associated with assembly bind failure logging. 
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 
+0

当我评论此方法的误差消失: 静态无效SVN_SSL_Override(对象发件人,SharpSvn.Security.SvnSslServerTrustEventArgs E) { e.AcceptedFailures = e.Failures; e.Save = true; } –

+0

你检查过两个项目的目标平台是否一样? –

+2

还要确保被引用的PostSharp的版本在所有项目中都是相同的。 – ohiodoug

回答

0

我写道: “当我评论此方法的误差消失:静态无效SVN_SSL_Override(对象发件人,SharpSvn.Security.SvnSslServerTrustEventArgs E){e.AcceptedFailures = e.Failures; e.Save = TRUE;}”

不知道为什么,但有问题,所以我删除:

client.Authentication.Clear(); client.Authentication.SslServerTrustHandlers + = new EventHandler(SVN_SSL_Override); client.Authentication.DefaultCredentials = new NetworkCredential(“”,“”);

,并且此方法

静态无效SVN_SSL_Override(对象发件人,SharpSvn.Security.SvnSslServerTrustEventArgs E){e.AcceptedFailures = e.Failures; e.Save = true; } “

和刚添加:

client.Authentication.UserNamePasswordHandlers + =委托(obj对象,SharpSvn.Security.SvnUserNamePasswordEventArgs参数) { args.UserName =” “; args.Password = “”; args.Save = TRUE; };

,现在它的工作原理。

0

这有可能是SharpSVN组件无法加载,因为它引用了几个本地DLL(对于32位版本,SharpSvn-DB44-20-win32.dllSharpSvn-Sasl21-23-win32.dll)。如果这些文件不在系统搜索路径的某处(通常是ASP.NET的情况),那么SharpSVN可能无法加载。

我有一个similar problem与我的一个NuGet软件包不能在MVC网站上工作,因为本机DLL没有加载。将它们放在网站的bin文件夹中是不够的,因为bin文件夹既不在搜索路径中,也不是应用程序文件夹。

尝试添加下面的方法到应用程序类Global.asax.cs文件,并从Application_Start()调用它:

public static void CheckAddBinPath() 
{ 
    // find path to 'bin' folder 
    var binPath = Path.Combine(new string[] { AppDomain.CurrentDomain.BaseDirectory, "bin" }); 
    // get current search path from environment 
    var path = Environment.GetEnvironmentVariable("PATH") ?? ""; 

    // add 'bin' folder to search path if not already present 
    if (!path.Split(Path.PathSeparator).Contains(binPath, StringComparer.CurrentCultureIgnoreCase)) 
    { 
     path = string.Join(Path.PathSeparator.ToString(), new string[] { path, binPath }); 
     Environment.SetEnvironmentVariable("PATH", path); 
    } 
} 

这将您bin文件夹添加到只有你的应用系统搜索路径,这应该允许SharpSvn到找到它所依赖的本地DLL。只要确保这些文件实际存在 - 如果不是,您可能必须将其从SharpSvn发行版复制。

当然,我可以完全脱离标记。让我知道任何一种方式。

+0

将尝试此并让您知道结果。 –

+0

不,还是一样的错误。但是,求助 –

相关问题