我正在做一个网页,你可以浏览文件夹。我已经在单独的解决方案中完成了这一点,并且所有的解决方案都能工作,但是当我试图将它与多个同时引用PostSharp的项目集成时,我得到了以下错误:
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].
发布于 2013-12-03 13:28:18
我写道:“当我注释这个方法时,错误就消失了:静态的void 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 =新NetworkCredential("","");
而这种方法
静态空SVN_SSL_Override(对象发送方,SharpSvn.Security.SvnSslServerTrustEventArgs e) { e.AcceptedFailures = e.Failures;e.Save = true;}“
并补充说:
client.Authentication.UserNamePasswordHandlers +=委托(object obj,SharpSvn.Security.SvnUserNamePasswordEventArgs args) { args.UserName = "";args.Password = "";args.Save = true;};
现在起作用了。
发布于 2013-11-29 03:58:35
SharpSVN
程序集可能无法加载,因为它引用了一些本地DLL(32位版本的SharpSvn-DB44-20-win32.dll
和SharpSvn-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
发行版中复制它们。
当然,我可能会完全偏离目标。不管怎样让我知道。
https://stackoverflow.com/questions/20277586
复制相似问题