How to programmatically identify a file as a .NET assembly?

Is there a way to easily find assemblies?

+3
source share
3 answers

How to programmatically determine if a file is an assembly

Call the GetAssemblyName method, passing the full path to the file and the name of the file you are testing.

If a BadImageFormatException is thrown, the file is not an assembly.

http://msdn.microsoft.com/en-us/library/ms173100.aspx

+12
source

In addition to Jeff's suggestion, there seems to be a method for checking assembly compatibility without excluding an excluded document: http://www.codeguru.com/forum/showthread.php?t=424454

, .NET/ , , ASCI "BSJB" Framework, DLL/EXE.

, , / , Framework.

+2

Call AssemblyName.GetAssemblyNameand see if it throws an exception.

+1
source

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


All Articles