I am developing a .NET application (using C#). It uses reflection, including class System.Reflection.Assembly
.
I have a .dll
assembly in a file (the path is known), and I want to load it into Assembly
. I use this code:
using System.Reflection;
// ...
var assembly = Assembly.LoadFile("AssemblyPath");
But it just doesn't find the assembly, despite the fact that it exists. The exception was of type System.IO.FileNotFoundException
, and here's its message:
Could not load file or assembly 'C:\Users\Вова\source\repos\StreamingTest\bin\Debug\net7.0-windows10.0.22621.0\AForge.Video.FFMPEG.dll'. The specified module was not found.
What I have tried
- I ran this line. It wrote
True
.
Console.WriteLine(File.Exists("AssemblyPath"));
-
I tried using
Assembly.Load
instead ofAssembly.LoadFile
. Exception was the same. -
Didn't find any answers neither on Stack Overflow, nor in the Internet.
Aucun commentaire:
Enregistrer un commentaire