2

I read: .NET Dispatcher, for .NET Core?

I'm not able to apply both solution.

  • Solution of JBSnorro: Unable to find how to switch to "Microsoft.NET.Sdk.WindowsDesktop".
  • Solution of codevision: I use .net Core 3.1 instead of .net Core 3.0 and a .dll instead of .exe. The result is

enter image description here

Any idea how to access the Dispatcher from .net-core 3.1?

IMPORTANT Clemens solution works great. Also, by reloading the project directly from Visual Studio has the advantage to tell you more about the problem hidden in your .csproj file. I had unmatching UseWPF with UseWpf!

Eric Ouellet
  • 10,996
  • 11
  • 84
  • 119
  • 1
    It [tells you](https://stackoverflow.com/a/58476275/11683) where. In the C# project file, csproj. – GSerg Jan 15 '20 at 20:46
  • @GSerg, Tthanks a lot. I just realized that I had to open the .csproj file manually. But I got an error after I did the suggested solution...Perhaps because it is a dll or perhaps it is 3.1 instead of 3.0??? – Eric Ouellet Jan 15 '20 at 20:57

2 Answers2

5

The project file should look like this:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
    <PropertyGroup>
        <TargetFramework>netcoreapp3.1</TargetFramework>
        <UseWPF>true</UseWPF>
    </PropertyGroup>
</Project>

If the project is unloaded, use Reload Project from the content menu.

Clemens
  • 123,504
  • 12
  • 155
  • 268
0

Since a visual studio update has broke my project file my side i decide post how this should be done in 2022.

just check this checkbox in project properties.

enter image description here

then visual studio should rewrite your project file and add the framework wpf to your reference automaticaly.

enter image description here

Dams
  • 11
  • 2