Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
828 views
in Technique[技术] by (71.8m points)

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

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...