首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >dotnet 5的WPF调度程序

dotnet 5的WPF调度程序
EN

Stack Overflow用户
提问于 2021-07-08 19:41:37
回答 1查看 77关注 0票数 1

我们正在将.net Framework4.7迁移到.net 5。我们正在处理的项目是一个WPF项目,我们需要使用WPF的Dispatcher类。

在.net Framework4.7中,我们包含了using System.Windows.Threading;和参考WindowsBase,但在.net 5中无法做到这一点。

你知道是什么导致了这种奇怪的行为吗?

提前谢谢。

代码语言:javascript
复制
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <OutputType>Library</OutputType>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <CodeAnalysisRuleSet>..\.sonarlint\ccsharp.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Productive|AnyCPU'">
    <OutputPath>bin\Productive\</OutputPath>
    <DefineConstants>PRODUCTIVE;TRACE</DefineConstants>
    <Optimize>true</Optimize>
    <CodeAnalysisRuleSet>..\.sonarlint\ccsharp.ruleset</CodeAnalysisRuleSet>
    <UseWPF>true</UseWPF>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="C">
      <HintPath>..\Files\C.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <None Include="..\.sonarlint\ccsharp.ruleset">
      <Link>ce-terminalcsharp.ruleset</Link>
    </None>
    <None Include="..\Files\Log4Net.config">
      <Link>Log4Net.config</Link>
    </None>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="log4net">
      <Version>2.0.8</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
    <PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="2.0.70" />
    <PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.2" />
    <PackageReference Include="RestSharp">
      <Version>106.6.10</Version>
    </PackageReference>
    <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
    <PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.2.233001">
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>
  <ItemGroup>
    <AdditionalFiles Include="..\.sonarlint\SonarLint.xml">
      <Link>SonarLint.xml</Link>
    </AdditionalFiles>
  </ItemGroup>
  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>
</Project>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-07-08 19:50:25

在.NET 5中,System.Windows.Threading.Dispatcher当然是可用的。

如果要创建类库,项目文件应如下所示:

代码语言:javascript
复制
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0-windows</TargetFramework>
    <UseWPF>true</UseWPF>
  </PropertyGroup>

</Project>
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68300971

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档