Lm th? no ? ci ?t m?t h?i ?ng trong b? nh? Cache h?i ton c?u trong Visual Basic.NET hay Visual Basic 2005

D?ch tiu ? D?ch tiu ?
ID c?a bi: 315682 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

? Trang ny

TM T?T

Bi vi?t ny m t? cch t?o ra m?t tn m?nh m? cho m?t l?p rp v ? ci ?t m?t t?p tin .dll trong b? nh? Cache h?i ton c?u. Ton c?u L?p rp Cache (G?C) cho php b?n chia s? h?i chng qua nhi?u cc ?ng d?ng. G?C s? t? ?ng ?c ci ?t v?i cc.NET runtime. Cc thnh ph?n th?ng ?c lu tr? trong C:\WINNT\Assembly.

? ci ?t m?t h?i ?ng trong G?C, b?n ph?i cung c?p cho h?i ?ng m?t m?nh m? (c ngh?a l, tn duy nh?t trn ton c?u). Trn th?c t?, n khng ph?i l m?t tn nhng m?t kho m?t m? bm, ho?c ch? k?. Tn m?nh ?m b?o chnh xc c?u ph?n versioning, gip ? ngn ch?n cc thnh ph?n c cng tn t? xung ?t v?i nhau ho?c khng chnh xc ?c s? d?ng b?i m?t ?ng d?ng tiu th?.

Yu c?u

Cc m?c sau y m t? cc ph?n c?ng ?c gi?i thi?u, ph?n m?m, m?ng c s? h? t?ng, k? nng v ki?n th?c, v d?ch v? gi m b?n c?n:
  • Quy?n qu?n tr? my tnh m trn cc ?c chia s? l?p rp ang ?c ci ?t
Ki?n th?c c?n thi?t:
  • Chung quen v?i h?i ?ng trong.NET
  • Chung quen v?i vi?c s? d?ng cng c? t? cc d?u nh?c d?ng l?nh

Ton c?u h?i Cache

? t?o ra m?t d? n th vi?n l?p nh? b?ng cch s? d?ng Visual Studio .NET ho?c Visual Studio 2005, ? t?o ra m?t tn m?nh m?, v ? ci ?t cc t?p .dll c?a d? n trong b? nh? Cache h?i ton c?u, th?c hi?n theo cc b?c sau:
  1. M? ph?ng thu tr?c quan.NET ho?c Visual Studio 2005.
  2. T?o m?t d? n l?p th vi?n m?i ?t tnG?C trong Visual Basic.NET hay trong Visual Basic 2005.
  3. M?t tn m?nh l c?n thi?t. ? t?o ra cc kho m?t m? ny ghp, s? d?ng cng c? SN, n?m trong th m?c con \bin, ni m cc .NET Framework gi?i php pht tri?n Kit (SDK) ?c ci ?t. Cng c? SN l r?t d? s? d?ng. Cc bo co d?ng l?nh c d?ng sau:
    SN -k "C:\[DirectoryToPlaceKey]\[KeyName].snk"
  4. ? thu?n ti?n, t?o m?t th m?c tn lGACDemo trong c: \ do b?n c th? d? dng xc ?nh v? tr cc kha v truy c?p vo phm t? d?u nh?c l?nh.

    LU ?: ?i v?i h?u h?t ng?i dng, cc.NET cng c? n?m trong c: Program Files Files\Microsoft.NET\FrameworkSDK\Bin. Tr?c khi b?n g? l?nh sau SN, b?n c th? sao chp ?ng d?n ny tng t? nh trn my tnh c?a b?n ? cc.NET bin th m?c, lo?i ?a CD t? d?u nh?c l?nh, b?m chu?t ph?i vo dn ?ng d?n, v sau nh?n ENTER ? nhanh chng thay ?i th m?c ni cng c? SN c v? tr.

    Lo?i sau y:
    SN -k "C:\GACDemo\GACkey.snk"
    Chu y Trong cc.NET Framework 2.0, cc.NET cng c? ?c ?t t?i cc C: Program Files Files\Microsoft.NET\SDK\v2.0\Bin th m?c.
  5. M?t phm ?c t?o ra, nhng n khng ?c lin k?t v?i cc l?p rp c?a d? n. ? t?o Hi?p h?i ny, b?m p vo cc AssemblyInfo.vb t?p tin trong Visual Studio.NET hay Visual Studio 2005 gi?i php Thm hi?m. Thm sau y vo danh sch cc thu?c tnh l?p rp ?c bao g?m trong t?p tin ny theo m?c ?nh khi m?t d? n ?c t?o ra trong Visual Studio .NET hay trong Visual Studio 2005:
    <assembly: assemblykeyfile("c:\gacdemo\gackey.snk")=""></assembly:>
    Bin d?ch d? n b?ng cch nh?n CTRL + SHIFT + B. C thm m? l c?n thi?t vo th?i i?m ny ? ci ?t m?t t?p tin .dll trong G?C.
  6. B?n c th? ci ?t cc t?p tin .dll b?ng cch s? d?ng cc cng c? Gacutil ho?c b?ng cch ko cc t?p tin .dll vo th m?c thch h?p. N?u b?n s? d?ng cc Gacutil cng c?, b?n c th? s? d?ng l?nh sau y:
    gacutil-ti "C:\[PathToBinDirectoryInVSProject]\gac.dll"
    N?u b?n mu?n ko t?p tin, s? d?ng Microsoft Windows Explorer. M? hai th? hi?n c?a Windows Explorer. Trong m?t, i?u h?ng t?i v? tr c?a cc .dll t?p tin ?u ra cho d? n giao di?n i?u khi?n c?a b?n. Trong khc, i?u h?ng t?i c:\[SystemRoot]\Assembly.

    Ko t?p tin .dll c?a b?n vo cc th m?c.

Hon thnh m? danh sch (AssemblyInfo.vb)

Imports System.Reflection
Imports System.Runtime.InteropServices

<Assembly: AssemblyTitle("")> 
<Assembly: AssemblyDescription("")> 
<Assembly: AssemblyCompany("")> 
<Assembly: AssemblyProduct("")> 
<Assembly: AssemblyCopyright("")> 
<Assembly: AssemblyTrademark("")> 
<Assembly: CLSCompliant(True)> 
<Assembly: AssemblyKeyFile("C:\GACDemo\GACKey.snk")> 

<Assembly: Guid("E3492A62-5389-4286-94A3-1331CC29EA6D")> 
<Assembly: AssemblyVersion("1.0.*")> 
				

M? xc nh?n

  1. Kh?i ?ng Windows Explorer.
  2. i?u h?ng ?n C:\WINNT\assembly.
  3. T?m th?y G?C trong danh sch ? ci ?t .dll t?p.

TAI LIU THAM KHAO

? bi?t thm chi ti?t, h?y truy c?p trang Web Microsoft sau y:
Ci ?t m?t h?i ?ng vo b? nh? Cache c?a ton c?u h?i
http://msdn2.Microsoft.com/en-US/Library/dkkx7f79 (vs.71) .aspx
Ton c?u h?i Cache
http://msdn2.Microsoft.com/en-US/Library/yf1d93sz (vs.71) .aspx

Ton c?u h?i Cache cng c?http://msdn2.Microsoft.com/en-US/Library/ex0ss12c (vs.71) .aspx

Thu?c tnh

ID c?a bi: 315682 - L?n xem xt sau cng: 27 Thang Tam 2011 - Xem xt l?i: 2.0
p d?ng
  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft ASP.NET 1.1
  • Microsoft ASP.NET 1.0
T? kha:
kbvs2005swept kbvs2005applies kbhowtomaster kbmt KB315682 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:315682

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com