How to Reflect on the main app from a DLL with .NET?
I have a D开发者_JAVA技巧LL. from which I would like to get the app's name. The following code, called from the DLL, returns the DLL's full name:
string assemblyFullUncPath =
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
...so it isn't quite what I'm after. I could add an Assembly parameter, but I'd prefer not to. Is it possible?
Try Assembly.GetEntryAssembly()
.
精彩评论