Reactive: Why is there no direct support for net5.0-windows as TargetFramework?

Created on 26 Feb 2021  路  9Comments  路  Source: dotnet/reactive

Question

After migrating from .NET Core 3.1 to .NET 5.0, compilation fails due to the missing definition for ObserveOnDispatcher in WPF projects.

To enable Windows desktop (including WPF) one has to target net5.0-windows, but unfortunately System.Reactive does not directly support net5.0-windows.
The NuGet will fallback to net5.0 so Windows desktop extensions are not included.
To enable Windows desktop extensions one has to target at least net5.0-windows10.0.19041.

If you check the related Directory.Build.props targeting net5.0-windows would enable WPF extensions, but this TargetFramework is not defined in System.Reactive.csproj.

I simply wonder why this is and if it would be possible to add direct support for net5.0-windows without a specific Windows version?

[area] Rx

Most helpful comment

I was caught out by this too. It's quite surprising behavior

All 9 comments

I was caught out by this too. It's quite surprising behavior

Same here. I want to ObserveOn(DispatcherScheduler.Current) or ObserveOnDispatcher on net5.0-windows. If I copy the required code to my solution. The whole code works. So why the decision was made to limit to net5.0-10.0.19041?

I'm facing the same issue.
My project is targeting net5.0-windows-10.0.19041 with <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>,

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
    <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
    <RootNamespace>App4</RootNamespace>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <Platforms>x86;x64</Platforms>
    <RuntimeIdentifiers>win10-x86;win10-x64</RuntimeIdentifiers>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.ProjectReunion" Version="0.5.0" />
    <PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.5.0" />
    <PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.5.0" />
    <PackageReference Include="System.Reactive" Version="5.0.0" />
    <Manifest Include="$(ApplicationManifest)" />
  </ItemGroup>
</Project>

I would like to support all Windows 10 versions that are supported now. However, System.Reactive supports only the latest Windows 10 10.0.19041. So, the following waring is occurred:

image

Could you add TargetPlatformMinVersion to System.Reactive package?

Hi @clairernovotny, sorry for pinging you directly, but you seem to be the last one who committed to this repo.
I would like to get this issue resolved, since it adds an undesirable dependency to the project and the fix might be pretty straight forward. Is there any chance this issue could be prioritized a bit?

The Windows 10 19041 SDK is required for building apps that use Rx. They can target earlier versions of Windows. The version number in the TFM indicates the SDK required, not the OS minimum version.

Thank you for your response. I guess it is clear that this version number is not the minimum OS version, but it forces all consumers to set at least the same version number (which is over 250 projects in our solution btw.), but there seems to be no need for this specific version number, so I guess most developers would prefer if the NuGet then would only specify net5.0-windows as TFM.

I did not see any other NuGet that specifies the full TFM version if not actually needed.

Hi Claire, you said:

The Windows 10 19041 SDK is required for building apps that use Rx. They can target earlier versions of Windows. The version number in the TFM indicates the SDK required, not the OS minimum version.

How it impacts application on Windows 7? Probably it would be safer to use Rx 5 on Windows 7 but using .NET Framework, not .NET 5 - am I right?

Rx does not explicitly support Win7 as Win7 has been out of support for quite some time. If it happens to work, then it works. The full framework target should work there as not much has changed.

@clairernovotny

The Windows 10 19041 SDK is required for building apps that use Rx. They can target earlier versions of Windows. The version number in the TFM indicates the SDK required, not the OS minimum version.

In my understanding, you can set range of supported windows versions using TargetPlatformMinVersion on .csproj files.

For example:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
        <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="System.Reactive" Version="5.0.0" />
    </ItemGroup>
</Project>

In this case, Visual Studio reports warnings.
image

So I think that setting TargetFramework to net5.0-windows(I guess it is prefer in this case) or adding TargetPlatformMinVersion on System.Reactive need.

Was this page helpful?
0 / 5 - 0 ratings