Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

How to load a managed C# DLL from a path instead of loading from GAC using CLR profiler?

$
0
0

The managed DLL can be loaded when it is in GAC using the public key token and assembly name.

MetaDataAssemblyEmit->DefineAssemblyRef(pbPublicKeyOrToken, publicKeySize, assemblyName, &assemblyMetaData, NULL, 0, 0, &mdAssemblyRef);


I want to load the DLL reference from a physical path instead of loading from the GAC.

I tried the below code,

LoadLibrary(L"C:\Packages\MyDotNetAssembly.dll");

The above code loaded the DLL into the process, It is not loading the DLL into the CLR runtime.

So DefineAssemblyRef could not find the DLL. Getting the below error,

Could not load file or assembly 'MyDotNetAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8b6549a3d401ea66' or one of its dependencies. The system cannot find the file specified.

How can I load the managed DLL into the current runtime or app domain, to make it work via C++ code?

--Anbu--






Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>