assembly.load

Loading interdependent assemblies from C++/CLI

两盒软妹~` 提交于 2020-01-04 14:16:28
问题 I want to load two assemblies from C++/CLI; assembly A depends on assembly B, and both are VB.Net projects (3.5). I want them to load from a byte array, so I use Assembly::Load(), but when I try to instantiate a class from assembly A, the framework ignores the previously loaded assembly B and attempts to load it again, which fails because it is not in the search path. The "Name" of the assembly is the same, so I don't know why it fails. For testing purposes, my program loads the bytes

Load strongly-name assembly from specific path?

我只是一个虾纸丫 提交于 2020-01-02 17:16:14
问题 I have a strongly-named assembly, installed to a specific folder (and not the GAC). The name as shown in Reflector is: "Foo.Bar.TreeFrog, Version=1.2.1.0, Culture=neutral, PublicKeyToken=ac88c4a8b22089b4" and the path where it's installed is "c:\\QueueBall" Can I use Assembly.Load or Assembly.LoadFrom to load it, and if so how? Can I ensure that the strong naming is honored, i.e. that the DLL I'm loading really is the one I'm expecting and not an imposter with the same name? 回答1: You could

How to provide a fallback assembly instead of the one that can't be loaded?

Deadly 提交于 2019-12-22 04:49:13
问题 At runtime, if a referenced assembly fails to load with e.g. "Strong name validation failed" (because it's test-signed), is there a way to provide a substitution assembly from another path that is real-signed? I tried subscribing to AppDomain.CurrentDomain.AssemblyResolve, but it doesn't get fired, because the "bad" assembly technically exists, it just can't be loaded. Is there a generic way to provide a fallback assembly when an assembly can't be loaded? 回答1: I think you can just call

Weird behaviour when mixing loading of assemblies using Assembly.LoadFrom and Assembly.Load

百般思念 提交于 2019-12-19 19:22:12
问题 Weird behavior when mixing loading of assemblies using Assembly.LoadFrom and Assembly.Load I have encountered a weird behavior when loading assemblies with Assembly.LoadFrom and later on with Assembly.Load. I am loading an assembly using Assembly.LoadFrom, where the assembly is located in a folder which is not the execution folder. Later on in my test code when I try to load once again this assembly with Assembly.Load, the load fails with a System.IO.FileNotFoundException (“Could not load

Weird behaviour when mixing loading of assemblies using Assembly.LoadFrom and Assembly.Load

巧了我就是萌 提交于 2019-12-19 19:21:58
问题 Weird behavior when mixing loading of assemblies using Assembly.LoadFrom and Assembly.Load I have encountered a weird behavior when loading assemblies with Assembly.LoadFrom and later on with Assembly.Load. I am loading an assembly using Assembly.LoadFrom, where the assembly is located in a folder which is not the execution folder. Later on in my test code when I try to load once again this assembly with Assembly.Load, the load fails with a System.IO.FileNotFoundException (“Could not load

Weird behaviour when mixing loading of assemblies using Assembly.LoadFrom and Assembly.Load

旧城冷巷雨未停 提交于 2019-12-19 19:21:11
问题 Weird behavior when mixing loading of assemblies using Assembly.LoadFrom and Assembly.Load I have encountered a weird behavior when loading assemblies with Assembly.LoadFrom and later on with Assembly.Load. I am loading an assembly using Assembly.LoadFrom, where the assembly is located in a folder which is not the execution folder. Later on in my test code when I try to load once again this assembly with Assembly.Load, the load fails with a System.IO.FileNotFoundException (“Could not load

Load strongly-name assembly from specific path?

*爱你&永不变心* 提交于 2019-12-06 12:58:17
I have a strongly-named assembly, installed to a specific folder (and not the GAC). The name as shown in Reflector is: "Foo.Bar.TreeFrog, Version=1.2.1.0, Culture=neutral, PublicKeyToken=ac88c4a8b22089b4" and the path where it's installed is "c:\\QueueBall" Can I use Assembly.Load or Assembly.LoadFrom to load it, and if so how? Can I ensure that the strong naming is honored, i.e. that the DLL I'm loading really is the one I'm expecting and not an imposter with the same name? You could use LoadFrom : var assembly = Assembly.LoadFrom(@"c:\QueueBall\Foo.Bar.TreeFrog.dll"); Note that this will

How to provide a fallback assembly instead of the one that can't be loaded?

时光怂恿深爱的人放手 提交于 2019-12-05 04:35:17
At runtime, if a referenced assembly fails to load with e.g. "Strong name validation failed" (because it's test-signed), is there a way to provide a substitution assembly from another path that is real-signed? I tried subscribing to AppDomain.CurrentDomain.AssemblyResolve, but it doesn't get fired, because the "bad" assembly technically exists, it just can't be loaded. Is there a generic way to provide a fallback assembly when an assembly can't be loaded? I think you can just call assembly.LoadFrom to load the assembly of your choice with practically no security checks. We us this a lot at the

How to run NUnit programmatically

旧城冷巷雨未停 提交于 2019-12-04 07:46:23
问题 I have some assembly that references NUnit and creates a single test class with a single test method. I am able to get the file system path to this assembly (e.g. "C:...\test.dll"). I would like to programmatically use NUnit to run against this assembly. So far I have: var runner = new SimpleTestRunner(); runner.Load(path); var result = runner.Run(NullListener.NULL); However, calling runner.Load(path) throws a FileNotFound exception. I can see through the stack trace that the problem is with

C# Assembly.Load vs Assembly.ReflectionOnlyLoad

天大地大妈咪最大 提交于 2019-12-03 05:23:49
问题 I'm trying to understand the differences between Assembly.Load and Assembly.ReflectionOnlyLoad. In the code below I am attempting to find all of the objects in a given assembly that inherit from a given interface: var myTypes = new List<Type>(); var assembly = Assembly.Load("MyProject.Components"); foreach (var type in assembly.GetTypes()) { if (type.GetInterfaces().Contains(typeof(ISuperInterface))) { myTypes.Add(type); } } This code works fine for me, but I was doing some research into