HOW TO: Create an Assembly with a Strong Name
来源:互联网 发布:excel数据分析图 编辑:程序博客网 时间:2024/05/29 08:01
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>an class="baidu_ad"> an> ank>HOW ank>TO: ank>Create an Assembly with a Strong Name
--------------------------------------------------------------------------------
The information in this article applies ank>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 crypank>TOgraphic 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 ank>HOW ank>TO ank>Create an Assembly with a Strong Name.
back ank>TO the ank>TOp
Prerequisites
This article assumes that you have installed and are familiar with Visual Studio .NET.
back ank>TO the ank>TOp
Creating an Assembly with a Strong Name
Use the Strong Name ank>TOol (Sn.exe) that comes with the .NET Framework Software Development Kit (SDK) ank>TO generate a crypank>TOgraphic key pair.
The following command uses the Strong Name ank>TOol ank>TO generate a new key pair and sank>TOre it in a file called TestKey.snk:
sn -k Testkey.snk
Add the proper cusank>TOm attribute ank>TO your source for the compiler ank>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 Crypank>TOgraphic Service Provider (CSP). For keys that are sank>TOred in a file, use the System.Reflection.AssemblyKeyFileAttribute attribute. For keys that are sank>TOred in the CSP, use the System.Reflection.AssemblyKeyNameAttribute attribute.
The following code uses AssemblyKeyFileAttribute ank>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 ank>TO the ank>TOp
REFERENCES
For more information about the Strong Name ank>TOol (Sn.exe), see the following Microsoft .NET Framework ank>TOols Web site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpank>TOols/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 ank>TO the
gzhanyunying/wangzhanyouhua/" title="seo,搜索引擎优化">seover="window.status='正文--ank>HOW ank>TO: ank>Create an Assembly with a Strong Name';return true">
<Strong><script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
--------------------------------------------------------------------------------
The information in this article applies ank>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 crypank>TOgraphic 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 ank>HOW ank>TO ank>Create an Assembly with a Strong Name.
back ank>TO the ank>TOp
Prerequisites
This article assumes that you have installed and are familiar with Visual Studio .NET.
back ank>TO the ank>TOp
Creating an Assembly with a Strong Name
Use the Strong Name ank>TOol (Sn.exe) that comes with the .NET Framework Software Development Kit (SDK) ank>TO generate a crypank>TOgraphic key pair.
The following command uses the Strong Name ank>TOol ank>TO generate a new key pair and sank>TOre it in a file called TestKey.snk:
sn -k Testkey.snk
Add the proper cusank>TOm attribute ank>TO your source for the compiler ank>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 Crypank>TOgraphic Service Provider (CSP). For keys that are sank>TOred in a file, use the System.Reflection.AssemblyKeyFileAttribute attribute. For keys that are sank>TOred in the CSP, use the System.Reflection.AssemblyKeyNameAttribute attribute.
The following code uses AssemblyKeyFileAttribute ank>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 ank>TO the ank>TOp
REFERENCES
For more information about the Strong Name ank>TOol (Sn.exe), see the following Microsoft .NET Framework ank>TOols Web site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpank>TOols/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 ank>TO the
<Strong><script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- HOW TO: Create an Assembly with a Strong Name
- How to sign C++/CLI assemblies with a strong name?
- Sign a .NET Assembly with a Strong Name Without Recompiling
- Sign Assembly with strong name
- Giving a .NET Assembly a Strong Name
- How to embed a manifest in an assembly
- How to create an EMF model from a Java application ?
- How To Create a Modeless CPropertySheet with Standard Buttons
- how to create a window ot dialog with fixed size?
- Conclusion: How to create a color Bitmap with CreateCompatibleBitmap
- How to create and apply a patch with git
- How To Create a Simple Magazine App with Core Text
- How To Create a Simple Magazine App with Core Text
- How to create a Java component with Eclipse
- how-to-create-a-simple-magazine-app-with-core-text
- How to create and apply a patch with Git
- How to create a jar file with Maven
- 关于解决 C# CSC: Assembly generation failed -- Referenced assembly ... does not have a strong name
- PHP中字体应用释疑
- 图象显示和翻转控件(用户自定义控件)--我也来凑凑热闹--(转)
- 用PHP4中的PDF扩展来创建一个PDF文档
- 《.net编程先锋C#》第三章 第一个C#应用程序(转)
- PHP如何生成动态图象?
- HOW TO: Create an Assembly with a Strong Name
- PHP中的XML应用
- 《.net编程先锋C#》第五章 类(转)
- PHP中的Java扩展
- 《.net编程先锋C#》第七章 异常处理(转)
- 如何用PHP调用自己编写的COM组件?
- 《.net编程先锋C#》第二章 理论基础-公用语言 运行环境(转)
- PHP中的模板技术
- Using DropDownList control in DataGrid