We are migrating .net framework 4.7 to .net 5. The project in which we are working is a WPF Project, and we need to use the Dispatcher class for WPF.
In .net framework 4.7 we included using System.Windows.Threading;
and the reference WindowsBase, but we cannot do the same in .net 5.
Do you know which is causing this strange behaviour?
Thanks in advance.
<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>