System.Reactive.csproj 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <Project Sdk="Microsoft.NET.Sdk">
  2. <PropertyGroup>
  3. <TargetFrameworks>netstandard2.0;net472;uap10.0.18362;net8.0;net8.0-windows10.0.19041</TargetFrameworks>
  4. <Nullable>enable</Nullable>
  5. <DefineConstants>$(DefineConstants);LEGACY_SYSTEM_REACTIVE_FACADE</DefineConstants>
  6. </PropertyGroup>
  7. <!--
  8. API compatibility validation.
  9. See ADR 0006-api-compatibility-verification.md for more information about this configuration.
  10. -->
  11. <PropertyGroup>
  12. <EnablePackageValidation>true</EnablePackageValidation>
  13. <PackageValidationBaselineVersion>6.0.1</PackageValidationBaselineVersion>
  14. </PropertyGroup>
  15. <ItemGroup>
  16. <ApiCompatSuppressionFile Include="ApiCompatSuppressions.xml" />
  17. </ItemGroup>
  18. <Target Name="_SetUwpTfmForPackageValidation" BeforeTargets="RunPackageValidation">
  19. <!-- See ADR 0003-uap-targets.md for an explanation of this. (In short, the package validation tooling doesn't understand UWP.) -->
  20. <ItemGroup>
  21. <PackageValidationReferencePath Condition="%(PackageValidationReferencePath.TargetFrameworkMoniker) == '.NETCore,Version=v5.0'" TargetFrameworkMoniker="UAP,Version=10.0.18362.0" TargetPlatformMoniker="Windows,Version=10.0.18362.0" />
  22. </ItemGroup>
  23. </Target>
  24. <PropertyGroup>
  25. <Description>Legacy facade for Reactive Extensions (Rx) for .NET</Description>
  26. <PackageReadmeFile>readme.md</PackageReadmeFile>
  27. </PropertyGroup>
  28. <ItemGroup>
  29. <None Include="..\NuGet.Facades.Readme.md" Pack="true" PackagePath="\readme.md" />
  30. </ItemGroup>
  31. <ItemGroup>
  32. <!--
  33. This facade is much newer than the others. The rest were created
  34. at the time of the Great Unification (Rx 4.0) to provide backwards
  35. compatibility with Rx 3.1, so they need to retain the same assembly
  36. version number hack that Rx 3.1 introduced in an attempt to solve
  37. the plug-in problem described in https://github.com/dotnet/reactive/issues/97
  38. System.Reactive became a facade much later (Rx 7.0) in order to
  39. partially unwind the Great Unification. Since we had long since stopped
  40. using the assembly version number hack, we don't want to apply
  41. it here. The Directory.build.props file in the facades folder applies
  42. this, so we need to remove it.
  43. -->
  44. <Compile Remove="..\GlobalAssemblyVersion.cs" Link="GlobalAssemblyVersion.cs" />
  45. </ItemGroup>
  46. <PropertyGroup>
  47. <!-- Re-instate the normal versioning behaviour. -->
  48. <GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
  49. <GenerateAssemblyVersionInfo>true</GenerateAssemblyVersionInfo>
  50. </PropertyGroup>
  51. <!--
  52. The various platform-specific APIs that System.Reactive used to support are now deprecated,
  53. because we've moved to a more modular approach with separate packages for each platform, and
  54. this entails some changes to naming conventions. These deprecated types now live in this facade.
  55. -->
  56. <ItemGroup>
  57. <Compile Remove="Obsolete\**\*.*" />
  58. <Compile Remove="Obsolete\UWP\Linq\**" />
  59. <EmbeddedResource Remove="Obsolete\**\*.*" />
  60. <EmbeddedResource Remove="Obsolete\UWP\Linq\**" />
  61. <!-- Workaround so the files appear in VS -->
  62. <None Include="Obsolete\**\*.*" />
  63. <None Include="..\..\src\System.Reactive.For.WindowsRuntime\AsyncInfoExtensions.cs" Link="Obsolete\UWP\AsyncInfoExtensions.cs" />
  64. <None Remove="Obsolete\UWP\Linq\**" />
  65. <None Update="Obsolete\UWP\Strings_PlatformServices.Designer.cs">
  66. <DependentUpon>Obsolete\UWP\Strings_PlatformServices.resx</DependentUpon>
  67. </None>
  68. <None Include="..\..\src\System.Reactive.For.Uwp\Stubs.cs" Link="Obsolete\UWP\Stubs.cs" />
  69. <None Include="..\..\src\System.Reactive.For.Uwp\ThreadPoolTimerExtensions.cs" Link="Obsolete\UWP\Concurrency\ThreadPoolTimerExtensions.cs" />
  70. <None Update="Linq\QbservableEx.NAry.tt">
  71. <Generator>TextTemplatingFileGenerator</Generator>
  72. <LastGenOutput>QbservableEx.NAry.cs</LastGenOutput>
  73. </None>
  74. </ItemGroup>
  75. <ItemGroup Condition="$(TargetFramework.StartsWith('uap10.0'))">
  76. <Compile Include="Obsolete\UWP\**\*.cs" />
  77. <Compile Include="..\..\src\System.Reactive.For.Uwp\Stubs.cs" Link="Obsolete\UWP\Stubs.cs" />
  78. <Compile Include="..\..\src\System.Reactive.For.Uwp\ThreadPoolTimerExtensions.cs" Link="Obsolete\UWP\Concurrency\ThreadPoolTimerExtensions.cs" />
  79. </ItemGroup>
  80. <!-- WindowsRuntime (netX.0-windows and UWP) -->
  81. <ItemGroup Condition="$(TargetFramework.StartsWith('uap10.0')) or $(TargetFramework.StartsWith('net8.0-windows')) or $(TargetFramework.StartsWith('net9.0-windows'))">
  82. <EmbeddedResource Include="Obsolete\UWP\Strings_PlatformServices.resx" />
  83. <Compile Update="Obsolete\UWP\Strings_PlatformServices.Designer.cs">
  84. <DependentUpon>Obsolete\UWP\Strings_PlatformServices.resx</DependentUpon>
  85. <DesignTime>True</DesignTime>
  86. <AutoGen>True</AutoGen>
  87. </Compile>
  88. <Compile Include="..\..\src\System.Reactive.For.WindowsRuntime\AsyncInfoExtensions.cs" Link="Obsolete\UWP\AsyncInfoExtensions.cs" />
  89. <ProjectReference Include="..\..\src\System.Reactive.For.WindowsRuntime\System.Reactive.For.WindowsRuntime.csproj" />
  90. </ItemGroup>
  91. <!-- Windows Forms and WPF -->
  92. <ItemGroup Condition="('$(TargetFramework)' == 'net472') or $(TargetFramework.StartsWith('net8.0-windows')) or $(TargetFramework.StartsWith('net9.0-windows'))">
  93. <ProjectReference Include="..\..\src\System.Reactive.For.WindowsForms\System.Reactive.For.WindowsForms.csproj" />
  94. <ProjectReference Include="..\..\src\System.Reactive.For.Wpf\System.Reactive.For.Wpf.csproj" />
  95. </ItemGroup>
  96. <!-- Windows includes for Desktop and UWP -->
  97. <ItemGroup Condition=" '$(TargetFramework)' == 'net472' or $(TargetFramework.StartsWith('uap10.0')) or $(TargetFramework.StartsWith('net8.0-windows')) or $(TargetFramework.StartsWith('net9.0-windows'))">
  98. <Compile Include="Obsolete\Windows\**\*.cs" />
  99. <EmbeddedResource Include="Obsolete\Windows\**\*.resx" />
  100. </ItemGroup>
  101. <!-- .NET FX -->
  102. <ItemGroup Condition=" '$(TargetFramework)' == 'net472'">
  103. <Reference Include="System.Windows" />
  104. <Reference Include="System.Windows.Forms" />
  105. <Reference Include="WindowsBase" />
  106. <Compile Include="Obsolete\Remoting\**\*.cs" />
  107. </ItemGroup>
  108. <ItemGroup Condition=" '$(TargetFramework)' == 'net472' or $(TargetFramework.StartsWith('net8.0-windows')) or $(TargetFramework.StartsWith('net9.0-windows'))">
  109. <Compile Include="Obsolete\Desktop\**\*.cs" />
  110. </ItemGroup>
  111. <ItemGroup Condition="'$(TargetFramework)'=='uap10.0.18362'">
  112. <!--
  113. The .NET SDK doesn't expect TargetFrameworks to include uap10.0.18362, so it doesn't understand
  114. that this project is capable of using projects that target .NET Standard 2.0, with the result
  115. that it reports an error when trying to resolve the reference to System.Reactive.Net. So
  116. when building for UWP, we explicitly set the target framework here.
  117. -->
  118. <ProjectReference Include="..\..\src\System.Reactive.Net\System.Reactive.Net.csproj">
  119. <Aliases>SystemReactiveNet</Aliases>
  120. <SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
  121. </ProjectReference>
  122. </ItemGroup>
  123. <ItemGroup Condition="'$(TargetFramework)'!='uap10.0.18362'">
  124. <ProjectReference Include="..\..\src\System.Reactive.Net\System.Reactive.Net.csproj">
  125. <Aliases>SystemReactiveNet</Aliases>
  126. </ProjectReference>
  127. </ItemGroup>
  128. <ItemGroup Condition="'$(TargetFramework)'=='uap10.0.18362'">
  129. <ReferencePath Include="$(TargetPlatformSdkPath)UnionMetadata\10.0.19041.0\Windows.winmd" />
  130. </ItemGroup>
  131. <!--
  132. Put the reference assemblies built by System.Reactive.MakeRefAssemblies into the 'ref' folder of our
  133. NuGet package.
  134. -->
  135. <ItemGroup>
  136. <ProjectReference Include="..\System.Reactive.MakeRefAssemblies\System.Reactive.MakeRefAssemblies.csproj" PrivateAssets="all">
  137. <!--
  138. If we don't set an alias here, all the types exposed by the reference assembly become available in the global namespace,
  139. which causes compiler errors when the UAP target tries to build a specialized ThreadPoolScheduler.
  140. -->
  141. <Aliases>SystemReactiveRefAssembly</Aliases>
  142. </ProjectReference>
  143. </ItemGroup>
  144. <!--
  145. We need to supply our own nuspec file, because the SDK doesn't appear to be able to populate the <references> section,
  146. and without that we get NU5131 warnings. (I think this is only strictly necessary for package.config scenarios, but
  147. Rx has a lot of users, so we'll probably break someone if we don't get this right.)
  148. We use tokenization so that we can pass package metadata (which include the version number). But it turns out that
  149. the various NuGet package metadata build properties we want to pass in don't get defined until quite late in the build,
  150. so we need to set <NuspecProperties> in a custom target that runs just before the GenerateNuspec target.
  151. -->
  152. <PropertyGroup>
  153. <NuspecFile>System.Reactive.nuspec</NuspecFile>
  154. </PropertyGroup>
  155. <Target Name="_SetNuspecProperties" BeforeTargets="GenerateNuspec">
  156. <PropertyGroup>
  157. <NuspecProperties>id=$(PackageId);version=$(PackageVersion);authors=$(Authors);licenseExpression=$(PackageLicenseExpression);icon=$(PackageIcon);projectUrl=$(PackageProjectUrl);description=$(PackageDescription);copyright=$(Copyright);tags=$(PackageTags);repository=$(RepositoryUrl);commit=$(RepositoryCommit);outputpath=$(OutputPath);refassemblypath=..\System.Reactive.MakeRefAssemblies\bin\$(Configuration)\</NuspecProperties>
  158. </PropertyGroup>
  159. </Target>
  160. </Project>