What I'm trying to accomplish is this; I have a class library I've made, but I want to be able to detect which application is using it since I have several applications using one library, but I want to be able to make certain functions available to one application and not have them available to any other applications, all while only having a single standalone class library. The information I'd like to be able to retrieve when the class library is referenced or called upon by an application is; the application name, version, and if it is signed.
Is this possible at all?
You can use reflection System.Reflection.Assembly.GetEntryAssembly()
to find the entry point for an application (eg. the executable assembly that was originally run).
Assembly caller = Assembly.GetEntryAssembly();
var name = caller.GetName();
var version = name.Version;
// etc.