- 热门文章:
- · 图象显示和翻转控件(用户自定义控件)--我也来凑凑热闹--(转)
- · web组件的通信---浅谈事件
- · Using DropDownList control in DataGrid
- · KW大师精品文章赏析
- · 实现一个客户端的DataSet-----index.htm
- · 实现一个客户端的DataSet-----ClientDataSetDataProvider.asmx.cs(1)
- · 实现一个客户端的DataSet-----ClientDataSetDataProvider.asmx.cs(2)
- · 实现一个客户端的DataSet-----ClientDataSet.htc
- · 安装framework以后出现不能显示aspx页面,提示用户名和密码不匹配问题的解决(chicken修改补充)
- · IIS5 HTTP500内部错误解决办法(转自eNet)------(一)
- · IIS5 HTTP500内部错误解决办法(转自eNet)------(二)
- · IIS5 HTTP500内部错误解决办法(转自eNet)-------(三)
HOW TO: Create an Assembly with a Strong Name
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft Visual Studio .NET Beta 2
--------------------------------------------------------------------------------
IN THIS TASK
SUMMARY
Prerequisites
Creating an Assembly with a Strong Name
REFERENCES
SUMMARY
Assemblies can be assigned a cryptographic signature called a strong name, which provides name uniqueness for the assembly and prevents someone from taking over the name of your assembly (name spoofing). If you are deploying an assembly that will be shared among many applications on the same computer, it must have a strong name. This document describes how to create an assembly with a strong name.
back to the top
Prerequisites
This article assumes that you have installed and are familiar with Visual Studio .NET.
back to the top
Creating an Assembly with a Strong Name
Use the Strong Name tool (Sn.exe) that comes with the .NET Framework Software Development Kit (SDK) to generate a cryptographic key pair.
The following command uses the Strong Name tool to generate a new key pair and store it in a file called TestKey.snk:
sn -k Testkey.snk
Add the proper custom attribute to your source for the compiler to emit the assembly with a strong name. Which attribute you use depends on whether the key pair that is used for the signing is contained in a file or in a key container within the Cryptographic Service Provider (CSP). For keys that are stored in a file, use the System.Reflection.AssemblyKeyFileAttribute attribute. For keys that are stored in the CSP, use the System.Reflection.AssemblyKeyNameAttribute attribute.
The following code uses AssemblyKeyFileAttribute to specify the name of the file that contains the key pair.
NOTE : In Microsoft Visual Basic, the assembly level attributes must appear as the first statements in the file.
Visual Basic .NET Code
Imports System
Imports System.Reflection
<assembly:AssemblyKeyFileAttribute("TestKey.snk")>
C# Code
using System;
using System.Reflection;
[assembly:AssemblyKeyFileAttribute("TestKey.snk")]
back to the top
REFERENCES
For more information about the Strong Name tool (Sn.exe), see the following Microsoft .NET Framework Tools Web site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfstrongnameutilitysnexe.asp
For more information about the .NET Framework SDK, see the following Microsoft Web site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/nfstart/html/sdkstart.asp
For more information about global attributes, see the C# Programmer@#s Reference.
back to the top
相关文章:
- · page_Load和page_Init的区别
- · 关于如何添加一个自增的列【原创】
- · 获得存储过程返回值的方法(return的值)
- · 关于返回前面的页面。如何两者兼得,自问自答
- · 在ASP.NET中的变量数值管理------看了这个我基本上对原来的REQUEST.FORM的方法传递变量绝望了
- · XML技术上传文件-转贴
- · 在datagrid中的HyperLinkColumn上达到谈出一个窗口的效果
- · 再datagrid中使用droplist。。。。重要的是其中的几个用法
- · 一个用C#做的HTTP SERVER(从WINFORM搬来的)
- · ViewState 到底是什么?
- · 允许用户一次上传多个文件
- · 用C# 实现Web文件的上传
- · ASP.NET Caching
- · ASP.NET Caching(2)
- · ASP.NET ViewState 初探 (3) 转自msdn
- · ASP.NET ViewState 初探 (2) 转自msdn
- · ASP.NET ViewState 初探 (1) 转自msdn
- · ASP.NET Framework深度历险(3)
- · ASP.NET下根据QueryString决定使用哪块javascript的两种方法 :)
- · ASP.NET Framework深度历险(2)
- · 图片上传的功能简介及web.config设置(自动生成所略图)
- · 图片上传的数据库部分(自动生成所略图)
- · 图片上传的WebForm(自动生成所略图)
- · 图片上传的Codebehind(自动生成所略图)
- · ASP.NET中的事务处理和异常处理
- · ASP.NET中异常处理使用(详细)
- · ASP.NET Framework深度历险(1)
- · 我写的上传(upload)文件的codebehind代码(1gdt)
- · 我写的上传(upload)文件的codebehind代码
- · 先装.net后装IIS的问题
- · Coalesys.WebMenu source code(partial)(5)
- · Coalesys.WebMenu source code(partial)(6)
- · Coalesys.WebMenu source code(partial)(7)
- · Coalesys.WebMenu source code(partial)(8)
- · Coalesys.WebMenu source code(partial)(9)
- · Coalesys.WebMenu source code(partial)(4)
- · Coalesys.WebMenu source code(partial)(10)
- · Coalesys.WebMenu source code(partial)(2)
