Read the Guid assembly without blocking the DLL in appdomain in the ASP.Net trust tool

Is it possible to read the GUID from the assembly without actually loading it into the current application domain.

Typically, Assembly.Load loads the DLL into the application domain. I just want to read the meaning.

GUID Description

'The following GUID is for the ID of the typelib 
' if this project is exposed to COM
<Assembly: Guid("DEDDE61CD-928E-4ACD-8C25-3B8577284819")> 

main thing: I do not want to lock the file so that there are no errors. "Another process is accessing the file error."

+3
source share
4 answers

If you load an assembly using Assembly.ReflectionOnlyLoad (byte []) , it will load it as a shadow and will not lock the file.

var bytes = File.ReadAllBytes(path);
var assembly = Assembly.ReflectionOnlyLoad(bytes);

, , Reflector access assembly, .

+6

, , , AppDomain Shadow Copy enabled ( , ASP.NET ) . .

, Assembly.Load(), [], , . , , .

+1

.NET PE (Program Executable). . IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR , IMAGE_COR20_HEADER, MetaData, Streams StreamHeaders. StreamHeaders #GUID Streams . IL Disassembler ildasm.exe( Windows SDK) .NET (. " " ), .

http://msdn.microsoft.com/en-us/magazine/cc301808.aspx http://www.ntcore.com/files/dotnetformat.htm#MetaSection http://www.visualcplusdotnet.com/visualcplusdotnet5a.html ( "Explorer Suite", http://ntcore.com/exsuite.php).

IID_IMetaDataDispenser . . http://www.remotesoft.com/salamander/obfuscator/MyApp/MyPrivateLib.cpp.txt "Meta" http://www.wheaty.net/downloads.htm

0

AppDomain (AppDomain.CreateDomain()), Assembly , AppDomain.Load(), , Guid , , AppDomain.Unload(), AppDomain.

, , , , Assembly . , - , . ( ).

0

Source: https://habr.com/ru/post/1747402/


All Articles