title: Doing c# class library a runnable application
body: <p>I want to create a console applicaiton and add it to another class library projects. So my class libraries will be runnable applicaitons.</p>
  
  <p><a href="https://i.stack.imgur.com/WSEIZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WSEIZ.png" alt="enter image description here"></a></p>
  
  <pre><code>namespace MyWorker.Host
  {
      class Program
      {
          static void Main(string[] args)
          {
  
          }
      }
  
      public interface IConfiguration
      {
          void Configure();
      }
  }
  </code></pre>
  
  <p>And I am adding my <code>MyWorker.Host</code> as reference to <code>MyWorker.Client</code> class library project. And debug settings set as "Start external program".</p>
  
  <p><a href="https://i.stack.imgur.com/WFvSZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WFvSZ.png" alt="enter image description here"></a></p>
  
  <p>And now I want to search client assemblies that referenced <strong>MyWorker.Host</strong>. I will find classes that implemented <code>IConfiguration</code> interface.</p>
  
  <pre><code>namespace MyWorker.Host
  {
      class Program
      {
          static void Main(string[] args)
          {
              var implementations = AppDomain
                  .CurrentDomain
                  .GetAssemblies()
                  .SelectMany(assemly =&gt; assemly.GetTypes())
                  .Where(t =&gt; !t.IsInterface)
                  .Where(t =&gt; typeof (IConfiguration).IsAssignableFrom(t));
  
              foreach (var assembly in implementations)
              {
                  Console.WriteLine(assembly.FullName);
              }
  
              Console.Read();
          }
      }
  }
  </code></pre>
  
  <p>But console writes <strong>nothing</strong>.</p>
  
  <p>(If I add a concrate class in MyWorker.Host it writes console.)</p>