I want to find the full path for libraries used in a given .NET application.
These are both, referenced assemblies (obtained as AssemblyName
s) and P/Invoke/DllImport
ed functions (obtained as just the dll name).
So basically I'm searching for the content of these two methods, where executablePath
is the path of that third party .NET application which can be completely different from my program.
static string ResolveAssemblyPath(AssemblyName name, string executablePath)
{
// ...
}
static string ResolveDllPath(string name, string executablePath)
{
// ...
}
It's important that these found libraries do not execute any code in the process of determining their full path! (DllMain
, module initializers, ...)
Is that even possible in every case? It's not an option to guess wrong.