Cast object to type from another assembly
<p>I have 3 projects: 2 are class libraries and 1 is console app:</p>

<ol>
<li><p>class library "AnimalManagers". In AnimalManagers is </p>

<pre><code>public interface AnimalAgressiveBase{
      string Bark&lt;TAnimal&gt;(TAnimal animal);
}
public abstract class AnimalAgressive&lt;TEnemy&gt; : AnimalAggresiveBase {
      public abstract string BarkAtEnemy(TEnemy enemy);

      public string Bark&lt;TAnimal&gt;(TAnimal animal){
            return BarkAtEnemy((TEnemy)animal);// &lt;---- Invalid cast exception even if type of object "animal" is Cat and we call this method from Dog class
      }
}

public class AnimalManager {

   public void WatchAnimal&lt;TAnimalModel&gt;
       (TAnimalModel animalModel) { //&lt;-- in example, animalModel is Cat("lucy")

          var aggresiveAnimalDog = GetAgresiveAnimal(); //&lt;-- returns object from dynamically loaded class Dog so this is basicaly new Dog() if animal models library class were referenced
          if(aggresiveAnimalData != null) aggresiveAnimalDog .Bark(animalModel);
   }
   public AnimalAgressiveBase GetAgresiveAnimal(){
       Assembly.LoadFrom("..\\AnimalModels.dll");
       ....
       return aggresiveAnimal; //In This case Dog because he implements correct interface
   }
}
</code></pre></li>
<li><p>class library "AnimalModels" In AnimalModels are model classes Cat and Dog</p>

<pre><code>public class Cat {
     public string Name {get;set;}

}

public class Dog : AnimalAgressive&lt;Cat&gt; {
    public override string BarkAtEnemy(Cat enemy){return enemy.Name;}
}
</code></pre></li>
</ol>

<p>Both libraries are referenced in ConsoleApp "Zoo" , and I get invalid type exception when I call </p>

<pre><code>var manager = new AnimalManager();
var manager.WatchAnimal(new Cat{Name="lucy"});
</code></pre>

<p>I got invalid cast exception because of dynamically loaded assembly types doesnt coresspond with referenced types, even if they got same AssemblyQualifiedName.</p>

<p>Any solutions? Goal is to load assembly get types that implements known interface (ex: AnimalAggressiveBase) and call method that I pass data of some type.</p>