Saqib Ullah

BootStrapper Know How

  Home  |   Contact  |   Syndication    |   Login
  93 Posts | 1 Stories | 341 Comments | 15 Trackbacks

News



Article Categories

Archives

Post Categories

Blogging websites

Favourite Blogs

Private Links

Sites

We had a Situation when we want to check different binaries files for managed assembly. In our case we had more than 100 files in which 50 of them are .Net assembles and we want to check all of them and load all of .Net assemblies for verification. The very common approach that comes in our mind is AppDomain. But the problem with AppDomain.CurrentDomain is that it not unload the loaded assemble from current AppDomain and keep in mind that we had around 50 .net assembles that we need to check.

Here is come a very handy utility I found in Microsoft.Build.Tasks.dll

 

        public bool FileIsAssembly(string assemblyName)

        {

            bool _loadAss = false;

            AssemblyIdentity identity = null;

            try

            {

              identity = AssemblyIdentity.FromFile(assemblyName);

 

              if (identity != null)

                  _loadAss = true;               

            }

            catch (Exception ex)

            { }

            return _loadAss;

        }

 

Enjoy geeks...

Assemble is not load in Current AppDomain so no need to unload that.

posted on Thursday, August 06, 2009 5:30 AM

Feedback

# re: Load .Net Assembly without loading it in AppDomain 11/13/2009 12:16 AM Varun
What exactly can you do once you have obtained the AssemblyIdentity. I mean is there any other practical use for the same.

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: