How to access the Dispatcher from a .net Core 3.1 dll (WPF)

余生颓废 提交于 2021-01-16 04:00:38

问题


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

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!


回答1:


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.



来源:https://stackoverflow.com/questions/59759175/how-to-access-the-dispatcher-from-a-net-core-3-1-dll-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!