°Ë±¦Êé¿â > ÎÄѧÆäËûµç×ÓÊé > VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ) >

µÚ95²¿·Ö

VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ)-µÚ95²¿·Ö

С˵£º VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ) ×ÖÊý£º ÿҳ4000×Ö

°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡




¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡section£»¡¡which¡¡is¡¡defined¡¡to¡¡be¡¡the¡¡type¡¡¡¡LoaderSection¡£¡¡We¡¡still¡¡create¡¡all¡¡available¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡types¡¡using¡¡the¡¡_availableTypes¡¡dictionary¡¡collection£»¡¡but¡¡the¡¡parsing¡¡and¡¡breaking¡¡apart¡¡of¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡various¡¡buffers¡¡are¡¡not¡¡necessary¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡353¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡1¡¡2¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡AR¡¡N¡¡IN¡¡G¡¡¡¡¡¡AB¡¡O¡¡U¡¡T¡¡¡¡¡¡AP¡¡P¡¡L¡¡I¡¡CAT¡¡I¡¡ON¡¡¡¡¡¡CO¡¡N¡¡F¡¡IG¡¡U¡¡R¡¡AT¡¡IO¡¡N¡¡¡¡¡¡A¡¡N¡¡D¡¡¡¡¡¡D¡¡Y¡¡N¡¡A¡¡M¡¡IC¡¡¡¡¡¡L¡¡O¡¡AD¡¡IN¡¡G¡¡331¡¡



¡öNote¡¡¡¡Writing¡¡your¡¡own¡¡configuration¡¡section¡¡is¡¡not¡¡that¡¡difficult£»¡¡but¡¡it¡¡is¡¡tedious¡£¡¡It¡¡is¡¡tedious¡¡because¡¡you¡¡¡¡

need¡¡to¡¡explicitly¡¡tell¡¡the¡¡configuration¡¡infrastructure¡¡what¡¡every¡¡item¡¡means¡¡and¡¡how¡¡you¡¡will¡¡use¡¡it¡£¡¡There¡¡is¡¡¡¡

no¡¡simple¡¡way¡¡to¡¡get¡¡around¡¡this£»¡¡because¡¡the¡¡configuration¡¡infrastructure¡¡needs¡¡to¡¡know¡¡which¡¡configuration¡¡¡¡

items¡¡should¡¡be¡¡processed¡¡and¡¡how¡¡they¡¡should¡¡be¡¡processed¡£¡¡Thus£»¡¡to¡¡implement¡¡a¡¡configuration¡¡section¡¡¡¡

with¡¡multiple¡¡items£»¡¡you¡¡will¡¡need¡¡to¡¡use¡¡more¡¡pieces¡¡of¡¡the¡¡predefined¡¡configuration¡¡infrastructure¡¡in¡¡the¡¡¡¡

same¡¡manner¡¡as¡¡illustrated¡¡by¡¡this¡¡simple¡¡example¡£¡¡See¡¡the¡¡¡¡configuration¡¡infrastructure¡¡documentation£»¡¡¡¡

at¡¡http£º//support¡£microsoft¡£/kb/313405/EN¡­US/£»¡¡for¡¡more¡¡information¡£¡¡



Loading¡¡a¡¡Strongly¡¡Named¡¡Assembly¡¡



In¡¡the¡¡previous¡¡section£»¡¡the¡¡example¡¡demonstrated¡¡the¡¡dynamic¡¡loading¡¡technique¡¡in¡¡which¡¡¡¡

you¡¡explicitly¡¡define¡¡where¡¡the¡¡assembly¡¡is¡¡and¡¡then¡¡instantiate¡¡a¡¡type¡¡in¡¡that¡¡assembly¡£¡¡Another¡¡¡¡

approach¡¡to¡¡instantiating¡¡an¡¡assembly¡¡involves¡¡using¡¡the¡¡formal¡¡declaration¡¡of¡¡a¡¡type¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡In¡¡£»¡¡there¡¡is¡¡an¡¡easy¡¡way¡¡to¡¡reference¡¡an¡¡assembly¡¡and¡¡a¡¡more¡¡difficult¡¡way¡¡to¡¡reference¡¡an¡¡¡¡

assembly¡£¡¡This¡¡is¡¡analogous¡¡to¡¡the¡¡easy¡¡way¡¡to¡¡identify¡¡a¡¡person¡¡and¡¡the¡¡more¡¡plicated¡¡way¡£¡¡¡¡

The¡¡easy¡¡way¡¡to¡¡identify¡¡me¡¡is¡¡to¡¡use¡¡my¡¡name£»¡¡Christian¡¡Gross£»¡¡and¡¡that¡¡works¡¡to¡¡a¡¡degree¡£¡¡The¡¡¡¡

problem¡¡is¡¡that¡¡I¡¯m¡¡not¡¡the¡¡only¡¡Christian¡¡Gross¡¡on¡¡this¡¡planet¡£¡¡The¡¡precise¡¡way¡¡to¡¡find¡¡me¡¡is¡¡to¡¡¡¡

look¡¡at¡¡my¡¡passport¡£¡¡The¡¡passport¡¡approach¡¡works£»¡¡but¡¡it¡¡has¡¡a¡¡long£»¡¡ugly¡¡number¡¡that¡¡is¡¡hard¡¡¡¡

to¡¡remember¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡The¡¡assembly¡¡name¡¡Implementations2¡£dll¡¡is¡¡a¡¡simple¡¡assembly¡¡identifier¡¡like¡¡Christian¡¡Gross¡£¡¡¡¡

The¡¡following¡¡is¡¡the¡¡precise¡¡¡¡identifier¡¡of¡¡the¡¡assembly¡£¡¡



Implementations2£»¡¡Version=1¡£0¡£0¡£0£»¡¡Culture=neutral£»¡¡PublicKeyToken=6bc4c8c27c08ba48¡¡



¡¡¡¡¡¡¡¡¡¡¡¡The¡¡identifier¡¡is¡¡quite¡¡a¡¡mouthful£»¡¡but¡¡it¡¡says¡¡everything¡¡you¡¡need¡¡to¡¡know¡£¡¡This¡¡specifies¡¡¡¡

the¡¡name¡¡as¡¡Implementations2£»¡¡the¡¡version¡¡number£»¡¡the¡¡culture¡¡£¨bination¡¡of¡¡language¡¡and¡¡¡¡

country£©£»¡¡and¡¡a¡¡fixed¡­signed¡¡identifier¡£¡¡When¡¡culture¡¡is¡¡defined¡¡as¡¡neutral£»¡¡it¡¡means¡¡that¡¡only¡¡¡¡

the¡¡language¡¡is¡¡taken¡¡into¡¡account¡¡and¡¡not¡¡the¡¡country¡­specific¡¡bit¡£¡¡For¡¡example£»¡¡if¡¡the¡¡culture¡¡¡¡

is¡¡en¡­CA£»¡¡with¡¡neutral£»¡¡the¡¡CA¡¡bit¡¡will¡¡be¡¡ignored£»¡¡which¡¡means¡¡a¡¡neutral¡¡form¡¡of¡¡English£»¡¡known¡¡¡¡

in¡¡this¡¡context¡¡as¡¡international¡¡English£»¡¡will¡¡be¡¡used¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡Using¡¡all¡¡of¡¡these¡¡attributes£»¡¡you¡¡can¡¡uniquely¡¡identify¡¡an¡¡assembly¡£¡¡This¡¡lets¡¡you¡¡load¡¡a¡¡¡¡

specific¡¡version¡¡of¡¡the¡¡assembly£»¡¡allowing¡¡multiple¡¡similar¡¡assemblies¡¡to¡¡be¡¡loaded¡¡simulta

neously¡£¡¡This¡¡specific¡¡referencing¡¡lets¡¡you¡¡to¡¡use¡¡ponents¡¡according¡¡to¡¡version¡¡and¡¡language¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡The¡¡extra¡¡information¡¡is¡¡specified¡¡in¡¡the¡¡source¡¡code¡¡file¡¡AssemblyInfo¡£vb¡£¡¡If¡¡you¡¡want¡¡to¡¡edit¡¡¡¡

this¡¡file£»¡¡select¡¡the¡¡project¡¡and¡¡then¡¡choose¡¡Project¡¡¡¡Show¡¡All¡¡Files¡£¡¡You¡¯ll¡¡find¡¡the¡¡AssemblyInfo¡£vb¡¡¡¡

file¡¡under¡¡the¡¡My¡¡Project¡¡node¡¡in¡¡the¡¡Solution¡¡Explorer¡£¡¡Following¡¡is¡¡the¡¡plete¡¡implementation¡¡¡¡

for¡¡Implementations2¡£dll¡£¡¡



Imports¡¡System¡¡

Imports¡¡System¡£Reflection¡¡

Imports¡¡System¡£Runtime¡£InteropServices¡¡



¡¡'¡¡General¡¡Information¡¡about¡¡an¡¡assembly¡¡is¡¡controlled¡¡through¡¡the¡¡following¡¡¡¡

¡¡'¡¡set¡¡of¡¡attributes¡£¡¡Change¡¡these¡¡attribute¡¡values¡¡to¡¡modify¡¡the¡¡information¡¡

¡¡'¡¡associated¡¡with¡¡an¡¡assembly¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡354¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

332¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡1¡¡2¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡A¡¡R¡¡N¡¡I¡¡N¡¡G¡¡¡¡¡¡A¡¡B¡¡OU¡¡T¡¡¡¡¡¡A¡¡PP¡¡L¡¡I¡¡CA¡¡TI¡¡O¡¡N¡¡¡¡¡¡CO¡¡N¡¡F¡¡I¡¡G¡¡U¡¡R¡¡AT¡¡IO¡¡N¡¡¡¡¡¡AN¡¡D¡¡¡¡¡¡D¡¡Y¡¡N¡¡A¡¡M¡¡I¡¡C¡¡¡¡L¡¡O¡¡AD¡¡I¡¡N¡¡G¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡Review¡¡the¡¡values¡¡of¡¡the¡¡assembly¡¡attributes¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'The¡¡following¡¡GUID¡¡is¡¡for¡¡the¡¡ID¡¡of¡¡the¡¡typelib¡¡if¡¡this¡¡project¡¡is¡¡exposed¡¡to¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡Version¡¡information¡¡for¡¡an¡¡assembly¡¡consists¡¡of¡¡the¡¡following¡¡four¡¡values£º¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡¡¡¡¡¡¡¡¡¡¡Major¡¡Version¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡¡¡¡¡¡¡¡¡¡¡Minor¡¡Version¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡¡¡¡¡¡¡¡¡¡¡Build¡¡Number¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡¡¡¡¡¡¡¡¡¡¡Revision¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡You¡¡can¡¡specify¡¡all¡¡the¡¡values¡¡or¡¡you¡¡can¡¡default¡¡the¡¡Build¡¡and¡¡Revision¡¡Numbers¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡by¡¡using¡¡the¡¡'*'¡¡as¡¡shown¡¡here£º¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Notice¡¡that¡¡all¡¡of¡¡the¡¡assembly¡¡descriptors¡¡are¡¡declared¡¡as¡¡¡¡attributes¡£¡¡The¡¡bolded¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡attributes¡¡reference¡¡the¡¡version¡¡of¡¡the¡¡assembly¡£¡¡By¡¡adjusting¡¡these¡¡attributes£»¡¡you¡¡can¡¡tweak¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡which¡¡assembly¡¡is¡¡loaded£»¡¡as¡¡explained¡¡in¡¡more¡¡detail¡¡in¡¡the¡¡uping¡¡¡°Versioning¡¡Assemblies¡±¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡section¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡To¡¡load¡¡a¡¡specific¡¡assembly£»¡¡you¡¡need¡¡to¡¡create¡¡an¡¡assembly¡¡name£»¡¡like¡¡this£º¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Dim¡¡assemblyName¡¡As¡¡AssemblyName¡¡=¡¡New¡¡AssemblyName£¨value£©¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Dim¡¡assembly¡¡As¡¡Assembly¡¡=¡¡Assembly¡£Load£¨assemblyName£©¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Dim¡¡obj¡¡As¡¡Object¡¡=¡¡assembly¡£CreateInstance£¨info¡£TypeName£©¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡variable¡¡value¡¡contains¡¡the¡¡precise¡¡¡¡identifier¡¡of¡¡the¡¡assembly¡¡and¡¡is¡¡passed¡¡as¡¡a¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡constructor¡¡parameter¡¡to¡¡AssemblyName¡£¡¡The¡¡resulting¡¡AssemblyName¡¡instance¡¡is¡¡passed¡¡to¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡method¡¡Assembly¡£Load£¨£©£»¡¡which¡¡loads¡¡the¡¡assembly¡£¡¡The¡¡instantiation¡¡of¡¡the¡¡type¡¡follows¡¡the¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡same¡¡sequence¡¡as¡¡previously¡¡outlined¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Note¡¡that¡¡there¡¡is¡¡no¡¡indication¡¡of¡¡where¡¡the¡¡assembly¡¡is¡¡located¡£¡¡The¡¡default¡¡locations¡¡that¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡are¡¡probed¡¡are¡¡the¡¡local¡¡working¡¡directory¡¡of¡¡the¡¡executing¡¡process¡¡and¡¡the¡¡GAC¡£¡¡¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡355¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡1¡¡2¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡AR¡¡N¡¡IN¡¡G¡¡¡¡¡¡AB¡¡O¡¡U¡¡T¡¡¡¡¡¡AP¡¡P¡¡L¡¡I¡¡CAT¡¡I¡¡ON¡¡¡¡¡¡CO¡¡N¡¡F¡¡IG¡¡U¡¡R¡¡AT¡¡IO¡¡N¡¡¡¡¡¡A¡¡N¡¡D¡¡¡¡¡¡D¡¡Y¡¡N¡¡A¡¡M¡¡IC¡¡¡¡¡¡L¡¡O¡¡AD¡¡IN¡¡G¡¡333¡¡



¡öNote¡¡¡¡For¡¡more¡¡details¡¡about¡¡assembly¡¡loading£»¡¡see¡¡Pro¡¡VB¡¡2008¡¡and¡¡the¡¡¡¡3¡£5¡¡Platform£»¡¡Third¡¡Edition¡¡¡¡

by¡¡Andrew¡¡Troelsen¡¡£¨Apress£»¡¡2008£©¡£¡¡



Relocating¡¡a¡¡Strongly¡¡Named¡¡Assembly¡¡to¡¡the¡¡GAC¡¡



Besides¡¡having¡¡the¡¡ability¡¡to¡¡tweak¡¡which¡¡assembly¡¡is¡¡loaded£»¡¡another¡¡reason¡¡to¡¡use¡¡the¡¡precise¡¡¡¡

assembly¡¡name¡¡is¡¡to¡¡have¡¡the¡¡ability¡¡to¡¡load¡¡an¡¡assembly¡¡from¡¡the¡¡GAC¡£¡¡The¡¡GAC¡¡is¡¡a¡¡place¡¡where¡¡¡¡

assemblies¡¡can¡¡be¡¡placed¡¡to¡¡have¡¡global¡¡shared¡¡access¡£¡¡Think¡¡of¡¡the¡¡GAC¡¡as¡¡the¡¡WindowsSystem32¡¡¡¡

directory¡¡of¡¡the¡¡¡¡environment¡£¡¡The¡¡precise¡¡location¡¡for¡¡the¡¡GAC¡¡is¡¡c£ºwindowsassembly¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡Even¡¡though¡¡the¡¡GAC¡¡is¡¡just¡¡another¡¡directory£»¡¡you¡¡should¡¡not¡¡just¡¡delete¡¡and¡¡add¡¡assemblies¡¡¡¡

there£»¡¡as¡¡you¡¡would¡¡with¡¡any¡¡other¡¡directory¡£¡¡To¡¡delete¡¡a¡¡file¡¡from¡¡the¡¡GAC£»¡¡use¡¡the¡¡context

sensitive¡¡Uninstall¡¡menu¡¡item¡¡£¨in¡¡Windows¡¡Explorer¡¡right¡­click¡¡the¡¡assembly¡¡you¡¡want¡¡to¡¡¡¡

uninstall¡¡and¡¡select¡¡Uninstall£©¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡To¡¡add¡¡an¡¡assembly¡¡to¡¡the¡¡GAC£»¡¡use¡¡the¡¡utility¡¡gacutil£»¡¡which¡¡is¡¡distributed¡¡with¡¡the¡¡¡¡¡¡

SDK¡¡£¨not¡¡with¡¡Visual¡¡Basic¡¡Express£©¡£¡¡You¡¡can¡¡locate¡¡it¡¡at¡¡C£ºProgram¡¡FilesMicrosoft¡¡SDKs¡¡

Windowsv6¡£0Bin¡¡or¡¡similar¡£¡¡Add¡¡this¡¡directory¡¡to¡¡your¡¡path¡¡so¡¡that¡¡you¡¡can¡¡run¡¡gacutil¡¡anywhere¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡The¡¡following¡¡mand¡¡lines¡¡demonstrate¡¡how¡¡to¡¡add¡¡the¡¡Definitions¡¡and¡¡¡¡

Implementations2¡¡assemblies¡¡to¡¡the¡¡GAC¡¡£¨assuming¡¡the¡¡files¡¡implementations2¡£dll¡¡and¡¡¡¡

definitions¡£dll¡¡reside¡¡in¡¡the¡¡current¡¡directory£©¡£¡¡¡¡



gacutil¡¡/I¡¡definitions¡£dll¡¡

gacutil¡¡/I¡¡implementations2¡£dll¡¡



¡¡¡¡¡¡¡¡¡¡¡¡Remember¡¡to¡¡add¡¡Definitions£»¡¡because¡¡Implementations2¡¡depends¡¡on¡¡Definitions¡£¡¡¡¡

Failing¡¡to¡¡add¡¡Definitions¡¡will¡¡generate¡¡gacutil¡¡errors¡£¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ORGANIZING¡¡DYNAMIC¡¡CODE¡¡



¡¡¡¡¡¡If¡¡you¡¡are¡¡going¡¡to¡¡place¡¡files¡¡in¡¡the¡¡GAC£»¡¡don¡¯t¡¡use¡¡the¡¡techniques¡¡demonstrated¡¡in¡¡this¡¡book¡¡when¡¡doing¡¡a¡¡¡¡

¡¡¡¡¡¡production¡¡release¡£¡¡The¡¡techniques¡¡discussed¡¡in¡¡this¡¡book¡¡are¡¡meant¡¡for¡¡developers£»¡¡and¡¡only¡¡developers¡£¡¡The¡¡¡¡

¡¡¡¡¡¡techniques¡¡are¡¡shortcuts¡¡that¡¡assume¡¡you¡¡know¡¡what¡¡the¡¡dependencies¡¡are¡¡and¡¡are¡¡aware¡¡of¡¡what¡¡you¡¡are¡¡¡¡

¡¡¡¡¡¡doing¡£¡¡For¡¡distribution¡¡purposes£»¡¡use¡¡the¡¡Microsoft¡¡Windows¡¡Installer¡¡application¡¡to¡¡install¡¡files¡¡into¡¡the¡¡GAC¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡When¡¡writing¡¡dynamic¡¡code£»¡¡the¡¡idea¡¡is¡¡to¡¡separate¡¡and¡¡pletely¡¡partmentalize¡¡the¡¡development¡¡¡¡

¡¡¡¡¡¡of¡¡the¡¡ponent¡¡and¡¡the¡¡caller¡¡of¡¡the¡¡ponent¡£¡¡Thus£»¡¡you¡¡should¡¡not¡¡develop¡¡both¡¡pieces¡¡in¡¡the¡¡same¡¡¡¡

¡¡¡¡¡¡project¡£¡¡Create¡¡separate¡¡projects¡¡and¡¡have¡¡them¡¡working¡¡with¡¡test¡¡routines¡£¡¡Then£»¡¡at¡¡runtime£»¡¡bine¡¡the¡¡¡¡

¡¡¡¡¡¡functionalities£»¡¡and¡¡everything¡¡should¡¡work¡¡£¨that¡¡is£»¡¡if¡¡you¡¡properly¡¡tested¡¡your¡¡code£©¡£¡¡



Using¡¡Version¡¡Numbers¡¡



Version¡¡numbers¡¡are¡¡a¡¡way¡¡of¡¡being¡¡able¡¡to¡¡control¡¡the¡¡features¡¡and¡¡robustness¡¡of¡¡an¡¡applica

tion¡£¡¡In¡¡the¡¡packaged¡¡software¡¡market£»¡¡the¡¡concept¡¡of¡¡the¡¡version¡¡number¡¡has¡¡nearly¡¡disappeared¡£¡¡¡¡

For¡¡example£»¡¡consider¡¡Microsoft¡¯s¡¡operating¡¡system¡¡versions£º¡¡Windows¡¡95£»¡¡Window¡¡98£»¡¡¡¡

Windows¡¡XP£»¡¡Windows¡¡2000£»¡¡Windows¡¡Vista£»¡¡and¡¡so¡¡on¡£¡¡


¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­Page¡¡356¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­

334¡¡¡¡¡¡¡¡¡¡¡¡¡¡CH¡¡AP¡¡T¡¡E¡¡R¡¡¡¡¡¡1¡¡2¡¡¡¡¡¡¡ö¡¡¡¡¡¡¡¡L¡¡E¡¡A¡¡R¡¡N¡¡I¡¡N¡¡G¡¡¡¡¡¡A¡¡B¡¡OU¡¡T¡¡¡¡¡¡A¡¡PP¡¡L¡¡I¡¡CA¡¡TI¡¡O¡¡N¡¡¡¡¡¡CO¡¡N¡¡F¡¡I¡¡G¡¡U¡¡R¡¡AT¡¡IO¡¡N¡¡¡¡¡¡AN¡¡D¡¡¡¡¡¡D¡¡Y¡¡N¡¡A¡¡M¡¡I¡¡C¡¡¡¡L¡¡O¡¡AD¡¡I¡¡N¡¡G¡¡



¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡In¡¡open¡¡source¡¡software£»¡¡version¡¡numbers¡¡are¡¡used¡¡extensively¡¡and¡¡are¡¡considered¡¡very¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡important¡£¡¡Yes£»¡¡the¡¡version¡¡numbers¡¡resemble¡¡a¡¡lottery¡¡ticket£»¡¡but¡¡they¡¡do¡¡follow¡¡a¡¡convention¡£¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Understanding¡¡the¡¡convention¡¡makes¡¡it¡¡easier¡¡to¡¡select¡¡open¡¡source¡¡packages¡£¡¡And¡¡more¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡important£»¡¡applying¡¡this¡¡version

·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨0£© ²È£¨1£©

Äã¿ÉÄÜϲ»¶µÄ