Learn how to register an assembly in the GAC.

Learn how to register an assembly in the GAC.
 
1) Create an assembly key file
Use the sn.exe tool to create a key file: sn -k StrongNameFile.snk
If your path environment variables aren't set, you'll have to go to the C:\Program Files\Microsoft.NET\FrameworkSDK\Bin\ directory to run sn.exe)
The filename "StrongNameFile.snk" can be any name you want.
2) Edit your assembly Now you have to add a tag which will link your assembly key to the assembly:
using System.Reflection;
[assembly:AssemblyKeyFile("StrongNameFile.snk")]
Normally this is done in the utility AssemblyInfo.cs (vb) file.
3)Add your assembly to the GAC
gacutil /i AssemblyFileName.dll
To uninstall this assembly from the GAC, use the command:
gacutil /u AssemblyFileName
4) (Opional) Add your assembly to machine.config
Locate the <assemblies> tag (for web apps,under <configuration>/<system.web>/<compilation>/<compilers>/<assemblies>)
Between the <assemblies> tags, enter:
<add assembly="AssemblyFileName, Version=0.0.0.0, Culture=neutral, PublicKeyToken=5edf592a9c40680c" />
You can get the information for the assembly attribute, by running the gacutil /l command which will return a list of all the assemblies in the GAC. You will have to look for the one you just added and copy the entire line (less the Custom=XXX part at the end).
At this point, you will be able to place this directive in your aspx pages.
<%@Import Namespace="YourNamespace"%>
or, you can set a reference in the Visual Studio IDE as you would with other GAC Assemblies.

转载于:https://www.cnblogs.com/philzhou/articles/3019396.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值