Call the GetMetadataReader method on the PE reader instance to create a metadata reader. Check the value of the IsAssembly property. If the value is true , the file is an assembly.
An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. Assemblies take the form of executable (.exe) or dynamic link library (. dll) files, and are the building blocks of . NET applications.
In . Net, an assembly can be: A collection of various manageable parts containing Types (or Classes) , Resources (Bitmaps/Images/Strings/Files) , Namespaces , Config Files compiled Privately or Publicly ; deployed to a local or Shared (GAC) folder; discover-able by other programs/assemblies and; can be version-ed.
The . NET framework consists of the concepts of modules, assemblies, which both store metadata and manifest information. An assembly can contain multiple modules. Visual C# only ever creates one module which is turned into an assembly by the C# compiler (csc.exe), but an assembly can link many .
How can I tell from the assembly name, or assembly class (or others like it), whether an assembly is part of the .NET framework (that is, System.windows.Forms
)?
So far I've considered the PublicKeyToken, and CodeBase properties, but these are not always the same for the whole framework.
The reason I want this information is to get a list of assemblies that my EXE file is using that need to be on client machines, so I can package the correct files in a setup file without using the Visual Studio setup system. The problem is, I don't want to pick up any .NET framework assemblies, and I want it to be an automatic process that is easy to roll out whenever a major update is finished.
The ultimate solution would be that there is an IsFramework property... :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With