如何从 .net Core 3.1 dll (WPF) 访问 Dispatcher [英] How to access the Dispatcher from a .net Core 3.1 dll (WPF)

查看:27
本文介绍了如何从 .net Core 3.1 dll (WPF) 访问 Dispatcher的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到:

知道如何从 .net-core 3.1 访问 Dispatcher 吗?

重要 Clemens 解决方案非常有效.此外,直接从 Visual Studio 重新加载项目的优势在于可以告诉您有关隐藏在 .csproj 文件中的问题的更多信息.我有无与伦比的 UseWPF 和 UseWpf!

解决方案

项目文件应该是这样的:

<属性组><TargetFramework>netcoreapp3.1</TargetFramework><UseWPF>true</UseWPF></PropertyGroup></项目>

如果项目已卸载,请使用内容菜单中的Reload Project.

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!

解决方案

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.

这篇关于如何从 .net Core 3.1 dll (WPF) 访问 Dispatcher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆