Why
- 因为需要在类库中使用
Application.Curreent
的调度器,又因为主要是使用Core
开发,所以简单记录一下。
How
- 在需要使用的类库的
csproj
上添加如下:
<PropertyGroup>
<TargetFramework>net9.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86</Platforms>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
- 最主要是加上
<UseWPF>true</UseWPF>