Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7722103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:05:19+00:00 2026-06-01T04:05:19+00:00

I am trying to get all assemblies in CurrentDomain using AppDomain.CurrentDomain.GetAssemblies() to write their

  • 0

I am trying to get all assemblies in CurrentDomain using AppDomain.CurrentDomain.GetAssemblies() to write their FullName into a DropDownList, however if I don’t instantiate them, they are not seen in returned array from GetAssemblies() in CurrentDomain.

They are all added as Reference and in Reference folder of the solution. Only time I can get them from the GetAssemblies() is when I first instantiate them.

How to overcome this problem with an easy and more generic way instead of instantiate them everytime when I add new Assembly, etc.

Due to company policy, I have to obfuscate some parts of the images:

enter image description here

All the assembilies are referenced in Reference folder:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T04:05:20+00:00Added an answer on June 1, 2026 at 4:05 am

    There is actually something subtle that happens here in addition to the other people’s comments.

    VisualStudio actually does not add .dll references to the assembly manifest of your built assembly’s reflection info unless they are actually used.

    As a sample, make a new project, and reference an assembly. I used nunit.framework.dll as an example.

    But don’t actually use it. My code is simply:

    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
            }
        }
    }
    

    But the Project does have a reference to NUnit in VisualStudio. Now build it, and open the assembly in ildasm.exe and the top of the manifest is:

    // Metadata version: v4.0.30319
    .assembly extern mscorlib
    {
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
      .ver 4:0:0:0
    }
    .assembly ConsoleApplication1
    {
        ...etc...
    

    Now, in the code, just use anything from NUnit:

    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Assert.IsTrue(true);
            }
        }
    }
    

    Again rebuild and check the assembly manifest in ildasm.exe:

    // Metadata version: v4.0.30319
    .assembly extern mscorlib
    {
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
      .ver 4:0:0:0
    }
    .assembly extern nunit.framework
    {
      .publickeytoken = (96 D0 9A 1E B7 F4 4A 77 )                         // ......Jw
      .ver 2:6:0:12051
    }
    .assembly ConsoleApplication1
    {
        ...etc...
    

    Note that now there is an extern in the IL. This also feeds reflection, so it knows what the dependent assemblies are to be loaded.

    Past that little detail, as other have stated, the runtime doesn’t actually load an assembly until it is needed for the first time, hence your AppDomain doesn’t have the assemblies loaded until you instantiate or use something from that assembly.


    That detail above comes into play when you start to try to use the Assembly.GetReferencedAssemblies() method.

    So in VisualStudio, I have a project that has these references:

    Microsoft.CSharp
    nunit.framework
    System
    System.Core
    System.Data
    System.Xml
    System.Xml.Linq
    

    Then I have the C# code:

    using System;
    using System.Reflection;
    using NUnit.Framework;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                var assemblies = Assembly.GetExecutingAssembly().GetReferencedAssemblies();
                foreach (var assemblyName in assemblies)
                {
                    Console.WriteLine(assemblyName.FullName);
                }
                Console.ReadKey();
            }
        }
    }
    

    Note that I even have a using NUnit.Framework; statement! But I don’t actually use NUnit anywhere, so it is not a referenced assembly. The output of running this is:

    mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    

    That is it.
    If I add this line into my test app:

    Assert.IsTrue(true);
    

    Now something actually uses NUnit,a nd my console output is:

    mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying get all html links within a string and replace them using
I am trying get all html links within a string and replace them using
iam trying to get all object's xpath's from loaded page via selenium something similar
Im trying to get all Leads / Contact / Accounts from the database. So
I'm trying to get all the direct reports of a User through Active Directory,
I'm trying to get all property names / values from an Outlook item. I
I am trying to get all the rows that exist in allData but not
I'm trying to get all controls in a winform disabled at the Load event.
I'm trying to get all the input elements from a certain form from jQuery
I am trying to get all the users information from the database and check

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.