Querying the x64-GAC

帅比萌擦擦* 提交于 2019-12-01 22:18:49
    [DllImport("fusion.dll")]
    public static extern IntPtr CreateAssemblyCache(...)

The return type for this function is HRESULT. Which is an int, not IntPtr in C#. Same thing on the QueryAssemblyInfo() declaration.

This could cause random failure when you target AnyCPU. Other than that the code is fine and it has no trouble finding assemblies in GAC_64 on my machine.

This is all available via System.EnterpriseServices assembly since.NET 1.1

var publisher = new System.EnterpriseServices.Internal.Publish();
publisher.GacInstall(@"C:\Temp\MyDLL.dll")

Or

publisher.GacRemove(@"C:\Temp\MyDLL.dll")
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!