tailieunhanh - Pro VB 2005 and the .NET 2.0 Platform Second Edition phần 5

Để khắc phục tình hình, tạo ra một tập tin cấu hình mới có tên và lưu nó trong cùng thư mục có chứa các ứng dụng , trong ví dụ này sẽ là C: \ MyApp. Mở tập tin này và nhập nội dung sau đây chính xác như được hiển thị (lưu ý rằng XML là trường hợp nhạy cảm!): | 388 CHAPTER 13 INTRODUCING .NET ASSEMBLIES To rectify the situation create a new configuration file named and save it in the same folder containing the application which in this example would be C MyApp. Open this file and enter the following content exactly as shown be aware that XML is case sensitive configuration runtime assemblyBinding xmlns urn schemas-microsoft-com probing privatePath MyLibraries assemblyBinding runtime configuration .NET .config files always open with a root element named configuration . The nested runtime element may specify an assemblyBinding element which nests a further element named probing . The privatePath attribute is the key point in this example as it is used to specify the subdirectories relative to the application directory where the CLR should probe. Do note that the probing element does not specify which assembly is located under a given subdirectory. In other words you cannot say CarLibrary is located under the MyLibraries subdirectory but MathUtils is located under the Bin subdirectory. The probing element simply instructs the CLR to investigate all specified subdirectories for the requested assembly until the first match is encountered. Note Be very aware that the privatePath attribute cannot be used to specify an absolute C SomeFolder SomeSubFolder or relative . SomeFolder AnotherFolder path If you wish to specify a directory outside the client s application directory you will need to make use of a completely different XML element named codeBase described later in the chapter. Multiple subdirectories can be assigned to the privatePath attribute using a semicolon-delimited list. You have no need to do so at this time but here is an example that informs the CLR to consult the MyLibraries and MyLibraries Tests client subdirectories probing privatePath MyLibraries MyLibraries Tests Once you ve finished creating run the client by double-clicking the

TỪ KHÓA LIÊN QUAN