title: .Net 5 - WPF, unit test woes
body: <p>I'm having some issues while playing around with .Net 5, so I'm hoping someone could shed some light on things. Having worked on a large enterprise .Net Framework solution for a number of years, .Net Core seems to have passed me by and I've had no exposure to it, which might explain some of my confusion...</p>
  <p><strong>Unit test references?</strong></p>
  <p>I have created a solution containing a WPF project (&quot;WPF App (.NET)&quot;), and a unit test project (&quot;MSTest Test project (.Net Core)&quot;). Both have been set to a target framework of &quot;.NET 5&quot; in their properties page.</p>
  <p>When I reference the WPF project from the unit test project, a yellow triangle appears alongside the project reference, and the following error in the Error List window:</p>
  <blockquote>
  <p>Project 'MyTestWpf.csproj' targets 'net5.0-windows'. It cannot be referenced by a project that targets '.NETCoreApp,Version=v5.0'</p>
  </blockquote>
  <p>How on earth do I reference the WPF project from the UT project?</p>
  <p><strong>Class lib referencing WPF types?</strong></p>
  <p>I have also created a .Net 5 class library, which needs to reference various WPF types (controls, etc), but I'm not sure how to configure the necessary assembly/framework references (in the Framework world I'd simply add assembly references to PresentationFramework, System.Xaml, etc). Somehow, through trial and error I did get this working, using a combination of these lines in the project file:-</p>
  <pre><code>&lt;Project Sdk=&quot;Microsoft.NET.Sdk.WindowsDesktop&quot;&gt;
  &lt;UseWPF&gt;true&lt;/UseWPF&gt;
  </code></pre>
  <p>as well as changing the target framework from &quot;net5.0&quot; to &quot;net5.0-windows&quot;.</p>
  <p>However I'm not sure which combination of these are actually required, or if I'm even supposed to be editing the project file by hand, which feels like a step backwards if it can't be done via Visual Studio!</p>