gpt4 book ai didi

.net - 如何从 GAC 中提取程序集?

转载 作者:行者123 更新时间:2023-12-03 04:29:13 26 4
gpt4 key购买 nike

我必须处理一个包,它将程序集直接安装到 GAC 中(例如,位于 %windows%/assembly 深处的某个位置)。

如何将实际程序集(DLL)从 GAC 转移到普通文件系统中?

谢谢。

最佳答案

我使用了 this article 的建议从 GAC 获取大会。

Get DLL Out of The GAC

DLLs once deployed in GAC (normally located at c:\windows\assembly) can’t be viewed or used as a normal DLL file. They can’t be directly referenced from VS project. Developers usually keep a copy of the original DLL file and refer to it in the project at development (design) time, which uses the assembly from GAC during run-time of the project.

During execution (run-time) if the assembly is found to be signed and deployed in GAC the CLR automatically picks up the assembly from the GAC instead of the DLL referenced during design time in VS. In case the developer has deleted the original DLL or don't have it for some reason, there is a way to get the DLL file from GAC. Follow the following steps to copy DLL from GAC

  1. Run regsvr32 /u C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\shfusion.dll

    • shfusion.dll is an explorer extension DLL that gives a distinct look to the GAC folder. Unregistering this file will remove the assembly cache viewer and the GAC folder will be then visible as any normal folder in explorer.
  2. Open “%windir%\assembly\GAC_MSIL”.

  3. Browse to your DLL folder into the deep to find your DLL.

  4. Copy the DLL somewhere on your hard disk and refer it from there in your project

  5. Run "regsvr32 %windir%\Microsoft.NET\Framework\<.NET version directory> \shfusion.dll" to re-register the shfusion.dll file and regain the original distinct view of the GAC.

关于.net - 如何从 GAC 中提取程序集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/714907/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com