Check GAC for an assembly

后端 未结 5 1458
温柔的废话
温柔的废话 2020-12-10 01:00

How to programmatically check GAC for an assembly?

5条回答
  •  旧时难觅i
    2020-12-10 01:28

    From .NET, the reflection API - Assembly.Load(...) will throw a FileNotFoundException if it does not find the assembly. The API requires a fully qualified assembly name, so I assume it must be in the GAC. I am using it to test for the presence of SQL Server Compact Edition:

    Assembly foo = Assembly.Load("System.Data.SqlServerCe, Version=3.5.1.0, " +
        "Culture=neutral, PublicKeyToken=89845dcd8080cc91");
    

提交回复
热议问题