Geeks With Blogs
Saqib Ullah BootStrapper Know How

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 6, 2009 5:30 AM .Net | Back to top


Comments on this post: Load .Net Assembly without loading it in AppDomain

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

# re: Load .Net Assembly without loading it in AppDomain
Requesting Gravatar...
Optimists always picture themselves accomplishing their goals.
Left by eve isk on Mar 09, 2011 11:30 PM

# re: Load .Net Assembly without loading it in AppDomain
Requesting Gravatar...
Your post is informative.send gifts to pakistan
Left by Aslam on Jun 13, 2011 5:54 AM

# re: Load .Net Assembly without loading it in AppDomain
Requesting Gravatar...
It is possible to even generate your personal styles for making the bridesmaid wedding dresses; if which is the case then you definitely really should get a quote value before hand.
Left by cocktail dresses 2011 on Dec 18, 2011 6:36 PM

# re: Load .Net Assembly without loading it in AppDomain
Requesting Gravatar...
So nice and helping post.
Left by asbestos Management on Dec 24, 2011 8:02 AM

# re: Load .Net Assembly without loading it in AppDomain
Requesting Gravatar...
The post is written in very a good manner and it contains many useful information for me. You have a very impressive writing style. Thanks for sharing.Keep up the Great work Thanks for your time and effort
Left by blackberry spy app on Dec 27, 2011 12:49 AM

# re: Load .Net Assembly without loading it in AppDomain
Requesting Gravatar...
The blog was absolutely fantastic! Lot of great information which can be helpful in some or the other way. Keep updating the blog,looking forward for more contents...Great job, keep it up..
Left by Blackberry Spy on Dec 29, 2011 5:29 AM

Your comment:
 (will show your gravatar)


Copyright © Saqib Ullah | Powered by: GeeksWithBlogs.net