如何删除原生图像?

时间:2010-05-26 12:45:07

标签: .net

我无法删除原生图片:

del c:\windows\assembly\native...\mscorlib\xxxx\mscorlib.ni.dll
access refused

适用于Windows XP,但不适用于Seven。

有人知道我该怎么办?

由于

2 个答案:

答案 0 :(得分:4)

您可能正在尝试从非提升的命令提示符。

但是,您应该使用.NET Framework提供的工具,而不是从文件系统访问GAC。通过使用适当的开关调用ngen.exe可以删除原生图像(调用ngen.exe /?以获取帮助):

ngen uninstall <assembly name> [scenarios] [config]
    Delete the native images of an assembly and its dependencies from
    the Native Images Cache.

无论如何,您正在尝试删除mscorlib的原生图像。您是否有任何特殊原因要删除此图片?这看起来像是在向我提出麻烦。

答案 1 :(得分:2)

在使用文件之前查看此类行为。获取Process Explorer(sysinternals)并执行“find handle or dll”搜索文件名。你必须杀死正在使用该图像的任何进程。