title: Add dynamically loaded WindowsForms control to a WPF WindowsFormsHost
body: <p>I have a WPF project where I load a WindowsForsm assembly (dll file) dynamically like this:</p>
  
  <pre><code>        Assembly currentAssembly = Assembly.LoadFile(System.IO.Directory.GetCurrentDirectory() + @"\" + fileName);            
          System.Windows.Forms.Control currentControl = (System.Windows.Forms.Control)currentAssembly.CreateInstance(featureName, false);
  
          featureHost.Child = currentControl;
  </code></pre>
  
  <p>My XAML code for the for the featureHost looks like this:</p>
  
  <pre><code>&lt;WindowsFormsHost Name="featureHost" Grid.Row="1" Margin="14,4,14,14" Background="WhiteSmoke"&gt;&lt;/WindowsFormsHost&gt;
  </code></pre>
  
  <p>The problem that I have is that in the C# code the currentControl will be null, but currentAssembly seasm to be loaded correctly. But if I add project reference to a project that is a Windows Forms project the currentControl getts the correct value. 
  Of coures I don't want to have a reference to a WindowsForms project that I don't need.
  Dose anyone have any suggestions on why it works like this and how I can fix it?
  I'm using .Net 4.0.</p>