C
C#4mo ago
LPeter1997

Could not load file or assembly '...' with a weaved DLL

I have a DLL I have weaved with Mono.Cecil, called Draco.Compiler. The weaver adds an assembly reference to Draco.Coverage, as the compiler DLL will call out to functions of this. When I execute with dotnet exec Draco.Compiler.dll, I get the usual exception indicating a failure to locate the assembly:
System.IO.FileNotFoundException: Could not load file or assembly 'Draco.Coverage, Version=0.2.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Now opening up the weaved DLL with ILSpy, all looks good and ILSpy actually manages to locate the dependency assembly as it's in the exact same folder as the weaved DLL. I'm not sure if ILSpy has a different/simpler assembly location strategy or something, but is there any way I could debug why this assembly loading fails when running with dotnet exec?
2 Replies
LPeter1997
LPeter1997OP4mo ago
I suppose the problem is the lack of entry in the deps.json? I'll try to add that... Yep, that was it
Hari
Hari4mo ago
Are you using .net framework or .net core?

Did you find this page helpful?