开发者

How to Reflect on the main app from a DLL with .NET?

开发者 https://www.devze.com 2022-12-16 19:25 出处:网络
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:

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().

0

精彩评论

暂无评论...
验证码 换一张
取 消