"CLR Via C#" -- Read Note Part 02

来源:互联网 发布:英文介绍淘宝网 编辑:程序博客网 时间:2024/05/01 13:22

Chapter 3 Shared Assemblies and Strongly Named Assemblies

 

1. Strongly Named Assembly

e.g.

"MyTypes, Version=1.0.8123.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

use /keyfile:<file> compiler switch:

csc /keyfile:MyCompany.snk Program.cs

 

Tool to generate public/private key pair.

SN.exe -k MyCompany.snk

 

First, you invoke SN.exe with the –p switch to
create a file that contains only the public key (MyCompany.PublicKey):
SN –p MyCompany.snk MyCompany.PublicKey
Then, you invoke SN.exe, passing it the –tp switch and the file that contains just the public
key:
SN –tp MyCompany.PublicKey

 

2. Global Assembly Cache (GAC)

You should never manually copy assembly files into GAC; instead, you should use tools to accomplish thsi task. These tools know the GAC's internal structure and how to generate the proper subdirectory names.

Tool: GACUtil.exe

 

 

 

Book Mark - Page 75

原创粉丝点击