I'm making a browser plugin using FireBreath Framework. Most of logic is written on C# and to call it from browser I've made a C++ wrapper. Browsers call C++ Native code which calls "proxy" Managed C++ code which calls an actual logic in C# project.
So I have 3 dlls:
All 3 dlls installed to a user directory (c:\Users\\AppData\Roaming\MyCompany\MyApp\1.0.0.0)
Problem is browser doesn't load C# dll. I use Side by Side manifest to declare dependencies.
I tried to make a separate manifest file to declare an assembly:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="MyAssembly" processorArchitecture="*" type="win32" version="1.0.0.0"/>
<file name="FirstDependency.dll"/>
<file name="SecondDependency.dll"/>
</assembly>
and added link to this dependency to the head dll (Native C++):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity name="MyAssembly" processorArchitecture="*" type="win32" version="1.0.0.0"/>
</dependentAssembly>
</dependency>
</assembly>
Also I tried to declare dependency directly in the head dll (Native C++):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<file name="FirstDependency.dll"/>
<file name="SecondDependency.dll"/>
</assembly>
Tried to link dependent dlls using #pragma directive:
#pragma comment(linker, "\"/manifestdependency:type='win32' name='FirstDependency' version='1.0.0.0' processorArchitecture='X86' language='*'\"")
#pragma comment(linker, "\"/manifestdependency:type='win32' name='SecondDependency' version='1.0.0.0' processorArchitecture='X86' language='*'\"")
I checked dependencies using Dependency Walker and it confirmed what dependency between Managed C++ and C# doesn't exist.
Plugin has access to the head dll (Native C++) and it loads Managed C++ as well BUT when Managed C++ calls C# dll - plugin fails, C# assembly can't be found.
If I put C# dll in the same directory with browser application (firefox.exe or chrome.exe) - it works.
Looks like Side By Side dependency doesn't work between Managed C++ & C#.
How I can load dependent dlls for my plugin?
Solved it.
Added ResolveEventHandler handler to C++/CLI proxy assembly which loads C# assembly from a user directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With