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...
Unit test references?
I have created a solution containing a WPF project ("WPF App (.NET)"), and a unit test project ("MSTest Test project (.Net Core)"). Both have been set to a target framework of ".NET 5" in their properties page.
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:
Project 'MyTestWpf.csproj' targets 'net5.0-windows'. It cannot be referenced by a project that targets '.NETCoreApp,Version=v5.0'
How on earth do I reference the WPF project from the UT project?
Class lib referencing WPF types?
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:-
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<UseWPF>true</UseWPF>
as well as changing the target framework from "net5.0" to "net5.0-windows".
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!