VB2008´ÓÈëÃŵ½¾«Í¨(PDF¸ñʽӢÎÄ°æ)-µÚ91²¿·Ö
°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡
section¡¡describes¡¡how¡¡to¡¡enable¡¡signing¡£¡¡
¡¡¡¡¡¡¡¡¡¡The¡¡CallRuntimeImplementation¡¡project¡¡is¡¡the¡¡user¡¡application¡¡and¡¡is¡¡responsible¡¡for¡¡calling¡¡¡¡
the¡¡functionality¡¡in¡¡Implementations1¡¡and¡¡Implementations2¡£¡¡What¡¡you¡¡need¡¡to¡¡consider¡¡very¡¡¡¡
carefully¡¡in¡¡the¡¡CallRuntimeImplementation¡¡project¡¡structure¡¡is¡¡that¡¡in¡¡the¡¡References¡¡node£»¡¡¡¡
only¡¡the¡¡Definitions¡¡project¡¡is¡¡present¡£¡¡It¡¡does¡¡not¡¡contain¡¡references¡¡to¡¡¡¡Implementations1¡¡or¡¡¡¡
Implementations2¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡It¡¡is¡¡important¡¡to¡¡understand¡¡that¡¡when¡¡a¡¡project¡¡does¡¡not¡¡have¡¡a¡¡reference¡¡to¡¡another¡¡¡¡
project£»¡¡it¡¡does¡¡not¡¡imply¡¡that¡¡the¡¡functionality¡¡cannot¡¡be¡¡used¡£¡¡To¡¡use¡¡the¡¡functionality¡¡of¡¡a¡¡¡¡
project¡¡that¡¡is¡¡not¡¡referenced£»¡¡you¡¡need¡¡to¡¡write¡¡code¡¡that¡¡will¡¡load¡¡the¡¡assembly¡¡dynamically¡£¡¡¡¡
With¡¡a¡¡dynamically¡¡loaded¡¡assembly£»¡¡you¡¡can¡¡do¡¡whatever¡¡is¡¡possible¡¡with¡¡a¡¡hard¡linked¡¡reference¡£¡¡
¡öNote¡¡¡¡Remember¡¡that¡¡assemblies¡¡are¡¡the¡¡results¡¡of¡¡piling¡¡a¡¡project¡£¡¡A¡¡code¡¡library¡¡will¡¡produce¡¡a¡¡DLL¡¡¡¡
file£»¡¡while¡¡an¡¡executable¡¡project¡¡will¡¡produce¡¡an¡¡EXE¡¡file¡£¡¡¡¡
Signing¡¡an¡¡Assembly¡¡
Signing¡¡an¡¡assembly¡¡is¡¡giving¡¡the¡¡assembly¡¡a¡¡strong¡¡name£»¡¡which¡¡is¡¡a¡¡unique¡¡name¡£¡¡Think¡¡of¡¡it¡¡¡¡
as¡¡follows¡£¡¡My¡¡name¡¡is¡¡Christian¡¡Gross£»¡¡and¡¡on¡¡this¡¡planet¡¡we¡¡call¡¡Earth£»¡¡there¡¡are¡¡probably¡¡a¡¡¡¡
few¡¡dozen¡¡people¡¡with¡¡the¡¡name¡¡Christian¡¡Gross¡£¡¡Our¡¡governments¡¡distinguish¡¡between¡¡the¡¡¡¡
various¡¡people¡¡with¡¡my¡¡name¡¡by¡¡way¡¡of¡¡a¡¡passport¡£¡¡A¡¡passport¡¡is¡¡a¡¡unique¡¡identifier¡¡that¡¡converts¡¡¡¡
my¡¡mon¡¡name¡¡into¡¡a¡¡strong¡¡name¡£¡¡This¡¡is¡¡exactly¡¡what¡¡happens¡¡when¡¡you¡¡use¡¡strong¡¡names¡¡¡¡
with¡¡an¡¡assembly¡£¡¡A¡¡strong¡¡name¡¡is¡¡required¡¡when¡¡you¡¡want¡¡to¡¡add¡¡the¡¡assembly¡¡to¡¡the¡¡global¡¡¡¡
assembly¡¡cache¡¡£¨GAC£©¡£¡¡The¡¡GAC¡¡is¡¡where¡¡you¡¡can¡¡place¡¡an¡¡assembly¡¡to¡¡make¡¡it¡¡available¡¡for¡¡¡¡
global¡¡shared¡¡access¡£¡¡You¡¯ll¡¡learn¡¡more¡¡about¡¡the¡¡GAC¡¡in¡¡the¡¡¡°Loading¡¡a¡¡Strongly¡¡Named¡¡¡¡
Assembly¡±¡¡section¡¡later¡¡in¡¡this¡¡chapter¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡By¡¡default£»¡¡signing¡¡is¡¡not¡¡used¡£¡¡To¡¡enable¡¡signing£»¡¡you¡¡need¡¡to¡¡alter¡¡the¡¡properties¡¡of¡¡¡¡
the¡¡project¡£¡¡Follow¡¡these¡¡steps¡¡to¡¡enable¡¡signing¡¡for¡¡the¡¡Implementations2¡¡project¡¡and¡¡the¡¡¡¡
Definitions¡¡project£º¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡1¡£¡¡Right¡click¡¡the¡¡project¡¡in¡¡the¡¡Solution¡¡Explorer¡¡and¡¡select¡¡Properties¡£¡¡
¡¡¡¡¡¡¡¡¡¡2¡£¡¡¡¡Click¡¡the¡¡Signing¡¡tab¡£¡¡
¡¡¡¡¡¡¡¡¡¡3¡£¡¡¡¡Check¡¡the¡¡Sign¡¡the¡¡Assembly¡¡check¡¡box¡£¡¡
¡¡¡¡¡¡¡¡¡¡4¡£¡¡¡¡Select¡¡¡¡from¡¡the¡¡bo¡¡box£»¡¡which¡¡pops¡¡up¡¡a¡¡dialog¡¡box¡¡allowing¡¡you¡¡to¡¡specify¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡file¡¡name¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡340¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
318¡¡¡¡¡¡¡¡¡¡¡¡¡¡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¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡5¡£¡¡¡¡Type¡¡in¡¡a¡¡key¡¡file¡¡name¡¡and¡¡a¡¡password£»¡¡and¡¡then¡¡click¡¡OK¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡6¡£¡¡¡¡Save¡¡your¡¡project¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Setting¡¡the¡¡Output¡¡Path¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡aim¡¡of¡¡the¡¡chapter¡¡is¡¡to¡¡demonstrate¡¡two¡¡things£º¡¡configuration¡¡files¡¡and¡¡the¡¡dynamic¡¡abil
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ities¡¡of¡¡¡£¡¡Explaining£»¡¡debugging£»¡¡and¡¡running¡¡the¡¡configuration¡¡source¡¡code¡¡is¡¡simple£»¡¡because¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡everything¡¡is¡¡laid¡¡out¡¡for¡¡you¡¡in¡¡the¡¡Visual¡¡Basic¡¡IDE¡£¡¡You¡¡will¡¡not¡¡run¡¡into¡¡any¡¡problems¡¡running¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡configuration¡¡code¡£¡¡However£»¡¡for¡¡the¡¡dynamic¡¡loading£»¡¡there¡¡is¡¡a¡¡plication¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡As¡¡you¡¯ve¡¡seen£»¡¡the¡¡¡¡CallRuntimeImplementation¡¡project¡¡does¡¡not¡¡have¡¡explicit¡¡references¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡to¡¡Implementations1¡¡and¡¡Implementations2¡£¡¡This¡¡means¡¡that¡¡if¡¡the¡¡code¡¡from¡¡Implementations1¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡or¡¡Implementations2¡¡is¡¡referenced¡¡from¡¡CallRuntimeImplementations¡¡using¡¡dynamic¡¡techniques£»¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Visual¡¡Basic¡¡Express¡¡will¡¡have¡¡no¡¡clue¡¡as¡¡to¡¡what¡¡you¡¡are¡¡doing¡£¡¡You¡¡might¡¡argue¡¡that¡¡there¡¡is¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡one¡¡Visual¡¡Basic¡¡Express¡¡solution£»¡¡and¡¡Implementations1¡¡and¡¡¡¡Implementations2¡¡are¡¡part¡¡of¡¡the¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡overall¡¡project£»¡¡but¡¡unless¡¡an¡¡explicit¡¡reference¡¡is¡¡made£»¡¡Visual¡¡Basic¡¡Express¡¡does¡¡not¡¡know¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡about¡¡this¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡However£»¡¡you¡¡can¡¡overe¡¡this¡¡problem¡¡fairly¡¡easily¡¡by¡¡changing¡¡where¡¡the¡¡projects¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡place¡¡their¡¡piled¡¡output¡£¡¡As¡¡a¡¡habit£»¡¡I¡¡often¡¡make¡¡all¡¡projects¡¡build¡¡to¡¡a¡¡central¡¡directory¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡You¡¡can¡¡set¡¡the¡¡output¡¡directory¡¡in¡¡the¡¡pile¡¡tab¡¡of¡¡a¡¡project¡¯s¡¡Properties¡¡window£»¡¡as¡¡shown¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡in¡¡Figure¡¡12¡2¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Figure¡¡12¡2¡£¡¡Setting¡¡the¡¡build¡¡output¡¡path¡¡to¡¡a¡¡mon¡¡path¡¡£¨¡£¡£bin£©¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡You¡¡need¡¡to¡¡set¡¡the¡¡Build¡¡Output¡¡Path¡¡field¡¡to¡¡a¡¡mon¡¡location¡¡for¡¡all¡¡projects¡£¡¡When¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡you¡¡do¡¡that£»¡¡a¡¡build¡¡will¡¡result¡¡in¡¡a¡¡directory¡¡structure¡¡like¡¡that¡¡shown¡¡in¡¡Figure¡¡12¡3¡¡£¨in¡¡the¡¡next¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡section£©¡£¡¡With¡¡all¡¡of¡¡the¡¡files¡¡in¡¡a¡¡mon¡¡directory£»¡¡running¡¡the¡¡dynamic¡loading¡¡routines¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡bees¡¡trivial¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡341¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡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¡¡319¡¡
Defining¡¡and¡¡Processing¡¡a¡¡Configuration¡¡File¡¡
A¡¡configuration¡¡file¡¡is¡¡a¡¡file¡¡that¡¡contains¡¡information¡¡about¡¡how¡¡a¡¡program¡¡should¡¡behave¡£¡¡¡¡
Configuration¡¡files¡¡by¡¡themselves¡¡do¡¡not¡¡control¡¡how¡¡a¡¡program¡¡behaves¡£¡¡For¡¡a¡¡configuration¡¡¡¡
file¡¡to¡¡influence¡¡the¡¡behavior¡¡of¡¡a¡¡program£»¡¡the¡¡program¡¡needs¡¡to¡¡read¡¡and¡¡act¡¡on¡¡the¡¡informa
tion¡¡in¡¡the¡¡configuration¡¡file¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡Using¡¡a¡¡configuration¡¡file¡¡is¡¡not¡¡as¡¡easy¡¡as¡¡you¡¡may¡¡think¡¡it¡¡is¡£¡¡Yes£»¡¡it¡¡is¡¡easy¡¡to¡¡define¡¡a¡¡¡¡
configuration¡¡file¡¡and¡¡read¡¡the¡¡configuration¡¡file¡£¡¡What¡¡is¡¡difficult¡¡is¡¡how¡¡to¡¡define¡¡where¡¡¡¡
the¡¡configuration¡¡file¡¡is¡¡located¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡Suppose¡¡you¡¡have¡¡an¡¡application¡¡that¡¡is¡¡installed¡¡on¡¡the¡¡hard¡¡disk£»¡¡and¡¡the¡¡application¡¡¡¡
must¡¡make¡¡an¡¡assumption¡¡about¡¡where¡¡the¡¡configuration¡¡file¡¡is¡¡stored¡£¡¡One¡¡assumption¡¡could¡¡¡¡
be¡¡the¡¡root¡¡directory¡¡of¡¡the¡¡C£º¡¡drive¡£¡¡Yet¡¡that¡¡could¡¡be¡¡incorrect£»¡¡because¡¡some¡¡puters¡¡don¡¯t¡¡¡¡
have¡¡C£º¡¡as¡¡the¡¡root¡¡drive¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡solves¡¡this¡¡problem¡¡in¡¡an¡¡interesting¡¡way£º¡¡whatever¡¡the¡¡executing¡¡application¡¡is¡¡called£»¡¡¡¡
the¡¡configuration¡¡file¡¡has¡¡the¡¡same¡¡name¡¡with¡¡a¡¡¡¡¡£config¡¡extension¡£¡¡Figure¡¡12¡3¡¡shows¡¡an¡¡example£»¡¡¡¡
in¡¡which¡¡the¡¡console¡¡application¡¡is¡¡CallRuntimeImplementation¡£exe¡£¡¡The¡¡configuration¡¡file¡¡is¡¡¡¡
CallRuntimeImplementation¡£exe¡£config¡£¡¡A¡¡configuration¡¡file¡¡and¡¡the¡¡assembly¡¡that¡¡it¡¡relates¡¡to¡¡¡¡
are¡¡located¡¡in¡¡the¡¡same¡¡directory¡£¡¡
Figure¡¡12¡3¡£¡¡A¡¡console¡¡application¡¡and¡¡its¡¡¡¡associated¡¡configuration¡¡file¡¡
¡öNote¡¡¡¡Naming¡¡the¡¡configuration¡¡file¡¡using¡¡a¡¡bination¡¡of¡¡the¡¡assembly¡¯s¡¡application¡¡name¡¡with¡¡the¡¡¡¡
¡¡¡£config¡¡extension¡¡is¡¡an¡¡example¡¡of¡¡a¡¡convention¡¡architecture¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡In¡¡this¡¡section£»¡¡you¡¯ll¡¡see¡¡how¡¡to¡¡write¡¡a¡¡configuration¡¡file¡¡and¡¡then¡¡reference¡¡it¡¡within¡¡an¡¡¡¡
application¡£¡¡This¡¡setup¡¡will¡¡use¡¡the¡¡configuration¡¡file¡¡whenever¡¡a¡¡request¡¡for¡¡a¡¡certain¡¡piece¡¡of¡¡¡¡
functionality¡¡is¡¡made¡¡and¡¡supply¡¡the¡¡exact¡¡location¡¡of¡¡the¡¡assembly¡£¡¡
Creating¡¡an¡¡XML¡Based¡¡Configuration¡¡File¡¡
The¡¡configuration¡¡file¡¡contains¡¡Extensible¡¡Markup¡¡Language¡¡£¨XML£©¡£¡¡XML¡¡is¡¡a¡¡way¡¡of¡¡structuring¡¡¡¡
a¡¡text¡¡file¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡Consider¡¡the¡¡following¡¡text¡¡structure¡¡using¡¡spaces¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡342¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
320¡¡¡¡¡¡¡¡¡¡¡¡¡¡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¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡First¡¡Element¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Second¡¡Element¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Third¡¡Element¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡First¡¡Element¡¡is¡¡a¡¡parent£»¡¡and¡¡¡¡Second¡¡Element¡¡and¡¡Third¡¡Element¡¡are¡¡subelements¡¡of¡¡the¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡parent¡£¡¡The¡¡structuring¡¡of¡¡the¡¡parent¡¡and¡¡child¡¡elements¡¡is¡¡fragile£»¡¡to¡¡say¡¡the¡¡least¡£¡¡We¡¡need¡¡a¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡more¡¡robust¡¡way¡¡of¡¡structuring¡¡the¡¡data£»¡¡which¡¡is¡¡where¡¡XML¡¡es¡¡in¡£¡¡Think¡¡of¡¡XML¡¡as¡¡having¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡the¡¡ability¡¡to¡¡define¡¡folders¡¡and¡¡folders¡¡within¡¡folders¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Let¡¯s¡¡define¡¡the¡¡XML¡¡that¡¡makes¡¡up¡¡a¡¡¡¡application¡¡configuration¡¡file¡£¡¡All¡¡¡¡applica
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡tion¡¡configuration¡¡files¡¡can¡¡be¡¡created¡¡using¡¡Visual¡¡Basic¡¡Express£»¡¡as¡¡follows£º¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡1¡£¡¡¡¡Right¡click¡¡the¡¡CallRuntimeImplementation¡¡project¡¡and¡¡select¡¡Add¡¡¡¡New¡¡Item¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2¡£¡¡¡¡Select¡¡Text¡¡File¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡3¡£¡¡¡¡Name¡¡the¡¡file¡¡App¡£config¡¡and¡¡click¡¡Add¡£¡¡The¡¡App¡£config¡¡file¡¡is¡¡created¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡It¡¡is¡¡fine¡¡to¡¡leave¡¡the¡¡name¡¡as¡¡is£»¡¡because¡¡when¡¡your¡¡¡¡application¡¡is¡¡piled£»¡¡the¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡application¡¡configuration¡¡file¡¡will¡¡be¡¡renamed¡¡and¡¡placed¡¡beside¡¡the¡¡¡¡application¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡öNote¡¡¡¡¡¡application¡¡configuration¡¡files¡¡apply¡¡to¡¡assemblies¡£¡¡Thus£»¡¡if¡¡an¡¡assembly¡¡uses¡¡the¡¡config
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡uration¡¡API£»¡¡the¡¡configuration¡¡file¡¡applied¡¡will¡¡be¡¡the¡¡one¡¡associated¡¡with¡¡the¡¡calling¡¡application¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Open¡¡the¡¡new¡¡App¡£config¡¡file¡¡and¡¡add¡¡the¡¡following¡¡XML£º¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡first¡¡line¡¡is¡¡called¡¡an¡¡XML¡¡declaration£»¡¡and¡¡it¡¡can¡¡specify¡¡the¡¡encoding¡¡that¡¡will¡¡be¡¡used¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¨plus¡¡other¡¡information£»¡¡which¡¡we¡¡won¡¯t¡¡need¡¡to¡¡concern¡¡ourselves¡¡with¡¡here£©¡£¡¡The¡¡second¡¡and¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡third¡¡lines¡¡define¡¡a¡¡root¡¡XML¡¡node¡¡£¨also¡¡called¡¡an¡¡XML¡¡element£©¡£¡¡Think¡¡of¡¡a¡¡root¡¡XML¡¡node¡¡as¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡analogous¡¡to¡¡a¡¡root¡¡folder¡¡where¡¡all¡¡of¡¡the¡¡other¡¡folders¡¡will¡¡be¡¡stored¡£¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡root¡¡node¡¡is¡¡started¡¡with¡¡the¡¡identifier¡¡configuration¡¡surrounded¡¡by¡¡angle¡¡brackets¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡The¡¡node¡¡is¡¡terminated¡¡by¡¡the¡¡same¡¡identifier¡¡and¡¡angle¡¡brackets£»¡¡with¡¡the¡¡addition¡¡of¡¡a¡¡slash¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡prefix¡¡to¡¡the¡¡identifier¡£¡¡The¡¡only¡¡place¡¡where¡¡another¡¡XML¡¡node¡¡can¡¡be¡¡placed¡¡is¡¡between¡¡the¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡beginning¡¡and¡¡ending¡¡XML¡¡nodes¡£¡¡For¡¡example£»¡¡this¡¡XML¡¡is¡¡invalid£º¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡In¡¡the¡¡example£»¡¡¡¡is¡¡started¡¡inside¡¡the¡¡declaration¡¡of¡¡£»¡¡but¡¡its¡¡termi
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡nation£»¡¡£»¡¡is¡¡outside¡¡the¡¡declaration¡¡of¡¡¡£¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Page¡¡343¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡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¡¡321¡¡
Adding¡¡the¡¡Dynamic¡¡Loading¡¡Configuration¡¡Items¡¡
A