How to check if a DLL file is registered?

后端 未结 7 1809
一生所求
一生所求 2020-12-01 08:07

How do I find whether a DLL file written in C# is registered or not programmatically?

I already tried this code, but it doesn\'t come off.

If I register a DL

7条回答
  •  广开言路
    2020-12-01 08:25

    If you mean registered in GAC, here is my consideration: to be registered in GAC, an assembly must be signed with a strong name (have a public key token in it's name).

    So you can try load it using Assembly.Load(string), if you got FileNotFoundException - assembly was not registered in GAC.

    If got no error, but result Assembly.GetName().GetPublicKeyToken() is null or empty -- this mean you found assembly in application directory, not in GAC.

提交回复
热议问题