Reputation: 306
Trying to update my WPF app to target .NET 5.0. However, I am getting the following error message
Project WpfWithTest is not compatible with net5.0 (.NETCoreApp,Version=v5.0). Project WpfWithTest supports: net5.0-windows7.0 (.NETCoreApp,Version=v5.0)
If I change my WPF app to target ".NET Core 3.1 (Long-term support)", the problem goes away, but I want to target the latest version.
Also, there are several types of test projects available, but all of them seem give me the same error.
When I try updating the my test project, modifying Target Framework, to 5.0, it doesn't help (see screen shot below).
Bottom Line is that it only works if both projects target .NET 3.1
Upvotes: 0
Views: 378
Reputation: 3589
To test WPF projects, the test project framework also needs to be set to net-5.0-windows
.
Double-click on the test project in Visual Studio to open the .cspoj
file for the tests.
Then change the target framework to net5.0-windows
.
<TargetFramework>net5.0-windows</TargetFramework>
I can't find any way to do this using the Properties UI, while leaving the project as a console application. When the above settings are applied, the Properties UI shows the target framework as unset.
Upvotes: 2