I am trying to use Assembly.Load () to load an assembly located in the GAC. For example, let's say I want to list all the types that exist in PresentationCore.dll , how can I immerse PresentationCore.dll ?
When I try this:
Assembly a = Assembly.Load("PresentationCore.dll");
I get a FileNotFoundException . Another answer to SO suggested that I used Assembly.LoadFrom () for this - I hesitate to do this because Assembly.LoadFrom () is deprecated according to Visual Studio 2008 - plus it doesn't seem to actually work.
Any ideas?
GAC, .
, mscorlib.dll, - :
mscorlib.dll
Assembly a = Assembly.Load ("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
- Reflector :
http://i42.tinypic.com/2m30ocn.png
Assembly.Load(), DLL. DLL Reflector, . PresentationCore.dll - PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
Assembly.Load()
PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Runtime Locates Assemblies MSDN , , CLR .
Fusion Log Viewer . , Fusion, , .
- , :
string regStringMath = typeof(System.Math).Assembly; Assembly assMath = Assembly.Load("System.Math", regStringMath); string regStringPres = typeof(PresentationCore).Assembly; Assembly assPres = Assembly.Load("PresentationCore", regStringPres);
, .
GetAssemblyName (http://msdn.microsoft.com/en-us/library/system.reflection.assemblyname.getassemblyname.aspx), DLL Assembly.Load(),
Source: https://habr.com/ru/post/1710515/More articles:WPF text fields and borders - curious resizing - resizeInstalling multiple versions of a library in Delphi / C ++ Builder - delphiКэширование Visual Studio 2008 App.config - cachingIs it possible to temporarily duplicate and change rows on the fly in an SQL SELECT query? - sqlПроектирование WPF UserControl, который получает свой DataContext из внешних элементов управления: как иметь некоторые примеры данных в дизайнере, но использовать унаследованный DC во время выполнения? - wpfIt's fair to say that high code coverage and high performance are not needed for a well-designed unit test? - unit-testingPython urllib2 timeout when using Tor as a proxy? - pythonHow to create multi-stage animation of UIImageView? - iphoneWhat effect will denormalization have on requests, connections, and response time? - databaseFlex 3, cannot convert SystemManager to SystemManager when booting from the server? - flexAll Articles