args.Name For some reason it contains = "Project_file_backup.resources, Version = 1.0.0.0, Culture = ru-RU, PublicKeyToken = null"
And always: return null:
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { if (args.Name.StartsWith("7z")) { return Assembly.Load(Project1.Properties.Resources._7z); } else return null; } AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; var a = Assembly.Load(Project1.Properties.Resources._7z); SevenZipCompressor.SetLibraryPath(Path.Combine("", a.FullName)); {"Could not load file or assembly \" 1073664 bytes loaded from Project_file_backup, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null \ "or one of their dependencies. An attempt was made to load a program that has the wrong format."}
System.BadImageFormatException is not processed. FileName = 1073664 bytes loaded from Project_file_backup, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null FusionLog = "" = 1.0.0.0, Culture = neutral, PublicKeyToken = null "or one of their dependencies. An attempt was made to download a program that has the wrong format.
Source = mscorlib StackTrace: in System.Reflection.RuntimeAssembly.nLoadImage (Byte [] rawAssembly, Byte [] rawSymbolStore, Evidence evidence, StackCrawlMark & stackMark, Boolean fIntrospection, SecurityContextSource securityContextSource, in the system, in the same file, and in the same file, in the same way, in the same way, in the same way, the system will be used by the system, Boolean fIntrospection, SecurityContextSource securityContextSource, in the SystemCleanfile, SecurityContextSource, SecurityContextSource) in MyProcess.FileBackup.AddToArchive2 (String [] fileNames, String archiveName) ... in System.Threading.ExecutionContext.Run (ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in System.Threading.ExtECTEnthereEnactEnthereEnline_EnthereEnline_EnthereEnline_EnthereEnlineEnthereEnthereEbjectEntritEntrToArchive2 , ContextCallback callback, Object state) in System.Threading.ThreadHelper.ThreadStart () InnerException: HResult = -2147024885 Message = Incorrect IL format. InnerException:
Option2
public static void Load(string name) { String resourceName = "app1." + new AssemblyName(name).Name + ".dll"; using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) { Byte[] assemblyData = new Byte[stream.Length]; stream.Read(assemblyData, 0, assemblyData.Length); Assembly.Load(assemblyData); } } ...
Load(@"Resources\7z.dll"); //var currentDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //SevenZipCompressor.SetLibraryPath(Path.Combine(currentDir, @"Resources\7z.dll")); SevenZipCompressor.SetLibraryPath(Path.Combine(currentDir, ???Что здесь писать?)); //???Что здесь писать I look like they do here:
http://www.sql.ru/forum/868852/kak-sdelat-takoy-appdomain-currentdomain-assemblyresolve


Assembly.Load(byte[]), but it is quite difficult. And why do you need it, if not a secret? - VladDSevenZipCompressor.SetLibraryPath... I remember your previous question - there was no time to look. With this biblical did not work - without this method can not do? - Ev_Hyper