C# 注册DLL 到 GAC 目录
- 只有strong name的 DLL 才能被注册到 GAC 中
- GAC下的DLL名字不能重复
- GAC 的注册工具是 gacutil.exe
- “gacuntil.exe”需要管理员权限
- 使用示例
- 注册DLL到GAC目录
- DLL位置在 c:\MyTest\test.dll
- 注册命令 gacutil.exe /k c:\MyTest\test.dll
- 注册完成后可以在 gac 目录下查看到该 DLL
- 卸载注册到GAC目录下DLL
- 卸载GAC下DLL 只需要一个DLL名字即可
- 卸载命令 gacutil.exe test
- 卸载完成后,刚才注册的test.dll就会从gac目录下删除
- 注册DLL到GAC目录
- 具体详细命令 使用 /? 或者 /h 查看帮助文档
c:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools>gacuti
l.exe /h
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.33440
Copyright (c) Microsoft Corporation. All rights reserved.Usage: Gacutil [ ]
Commands:/i [ /r <...> ] [ /f ]Installs an assembly to the global assembly cache. is thename of the file that contains the assembly manifest.Example: /i myDll.dll /r FILEPATH c:\projects\myapp.exe "My App"/il [ /r <...> ] [ /f ]Installs one or more assemblies to the global assembly cache. is the path to a text file that contains a list ofassembly manifest file paths. Individual paths in the text file must beseparated by CR/LF.Example: /il MyAssemblyList.txt /r FILEPATH c:\projects\myapp.exe "My App"myAssemblyList.txt content:myAsm1.dllmyAsm2.dll/u [ /r <...> ]Uninstalls an assembly. is the name of the assembly(partial or fully qualified) to remove from the Global Assembly Cache.If a partial name is specified all matching assemblies will be uninstalled.Example:/u myDll,Version=1.1.0.0,Culture=en,PublicKeyToken=874e23ab874e23ab/r FILEPATH c:\projects\myapp.exe "My App"/uf Forces uninstall of an assembly by removing all traced references. is the full name of the assembly to remove.Assembly will be removed unless referenced by Windows Installer.!! Warning: use the /uf command with care as applications may fail to run !!Example: /uf myDll,Version=1.1.0.0,Culture=en,PublicKeyToken=874e23ab874e23a
b/ul [ /r <...> ]Uninstalls one or more assemblies from the global assembly cache. is the path to a text file that contains a list ofassembly names. Individual names in the text file must beseparated by CR/LF.Example: /ul myAssemblyList.txt/r FILEPATH c:\projects\myapp.exe "My App"myAssemblyList.txt content:myDll,Version=1.1.0.0,Culture=en,PublicKeyToken=874e23ab874e23abmyDll2,Version=1.1.0.0,Culture=en,PublicKeyToken=874e23ab874e23ab/l [ ]Lists the contents of the global assembly cache. When the optional parameter is specified only matching assemblies are listed./lr [ ]Lists the contents of the global assembly cache including traced referenceinformation. When the optional parameter is specified onlymatching assemblies are listed./cdlDeletes the contents of the download cache/ldlLists the contents of the download cache/?Displays a detailed help screenOld command syntax:/if equivalent to /i /f/ir equivalent to /i /r <...>/ur equivalent to /u /r <...>Options:/r Specifies a traced reference to install (/i, /il) or uninstall (/u, /ul). is the type of the reference being added(UNINSTALL_KEY, FILEPATH or OPAQUE). is the identifier of the referencing application,depending on the is a friendly description of the referencing application.Example: /r FILEPATH c:\projects\myapp.exe "My App"/fForces reinstall of an assembly regardless of any existing assembly withthe same assembly name./nologoSuppresses display of the logo banner/silentSuppresses display of all output
`
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
