Skip to content

Commit 7586eeb

Browse files
committed
Reorder code-blocks for better readability
To make diff understandable through blame and across similar project files, I have re-organized some lines in these project files. This also improves readability. Previously, the focus is per-project file but now—to maintain project logic across repos and several similar logic across project files, new way of authoring project files is required. This refactor is the start of it.
1 parent 8d205a1 commit 7586eeb

File tree

6 files changed

+58
-62
lines changed

6 files changed

+58
-62
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
<When Condition="'$(Configuration)' == 'Debug' and '$(IsDesignProject)' != 'true'">
4646
<!-- Debug builds have this turned on by default, but it breaks our Xaml Islands Scenarios -->
4747
<PropertyGroup>
48-
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
4948
<EnableXBindDiagnostics>false</EnableXBindDiagnostics>
49+
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
5050
</PropertyGroup>
5151
</When>
5252
</Choose>

Microsoft.Toolkit.HighPerformance/Microsoft.Toolkit.HighPerformance.csproj

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@
5858
</When>
5959

6060
<When Condition="'$(TargetFramework)' == 'netstandard2.1'">
61-
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
62-
<ItemGroup>
63-
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
64-
</ItemGroup>
65-
<PropertyGroup>
6661
<!--
6762
NETSTANDARD2_1_OR_GREATER: includes both .NET Standard 2.1 and .NET Core 3.1.
6863
This is needed because .NET Core 3.1 will be a separate package than .NET Standard 2.1.
@@ -75,8 +70,13 @@
7570
available on .NET Core 2.1. So by using this constant, we can make sure to expose those
7671
APIs relying on that method on all target frameworks that are able to support them.
7772
-->
73+
<PropertyGroup>
7874
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT</DefineConstants>
7975
</PropertyGroup>
76+
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
77+
<ItemGroup>
78+
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
79+
</ItemGroup>
8080
</When>
8181

8282
<When Condition="'$(TargetFramework)' == 'net5.0'">
@@ -86,9 +86,6 @@
8686
</When>
8787

8888
<When Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
89-
<ItemGroup>
90-
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
91-
</ItemGroup>
9289
<!--
9390
NETCORE_RUNTIME: to avoid issues with APIs that assume a specific memory layout, we define a
9491
.NET Core runtime constant to indicate either .NET Core 2.1 or .NET Core 3.1. These are
@@ -101,15 +98,18 @@
10198
<PropertyGroup>
10299
<DefineConstants>NETSTANDARD2_1_OR_GREATER;SPAN_RUNTIME_SUPPORT;NETCORE_RUNTIME</DefineConstants>
103100
</PropertyGroup>
104-
</When>
105-
106-
<When Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
107101
<ItemGroup>
108102
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
109103
</ItemGroup>
104+
</When>
105+
106+
<When Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
110107
<PropertyGroup>
111108
<DefineConstants>SPAN_RUNTIME_SUPPORT;NETCORE_RUNTIME</DefineConstants>
112109
</PropertyGroup>
110+
<ItemGroup>
111+
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
112+
</ItemGroup>
113113
</When>
114114
</Choose>
115115

Microsoft.Toolkit.Uwp.Notifications/Microsoft.Toolkit.Uwp.Notifications.csproj

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,20 @@
33
<PropertyGroup>
44
<TargetFrameworks>netstandard1.4;uap10.0.19041;net461;netcoreapp3.1;net5.0;net5.0-windows10.0.17763.0;native</TargetFrameworks>
55
<DefineConstants>$(DefineConstants);NETFX_CORE</DefineConstants>
6-
<ExtrasImplicitPlatformPackageIsPrivate Condition="'$(TargetFramework)' == 'native'">true</ExtrasImplicitPlatformPackageIsPrivate>
76
<NuspecFile>Microsoft.Toolkit.Uwp.Notifications.nuspec</NuspecFile>
87
</PropertyGroup>
98

10-
<Choose>
11-
<!--Desktop Win32 apps-->
12-
<When Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netcoreapp3.1'">
13-
<ItemGroup>
14-
<!--Reference Windows SDK NuGet of correct target platform version-->
15-
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
16-
</ItemGroup>
17-
</When>
18-
</Choose>
19-
20-
<PropertyGroup Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0-windows10.0.17763.0'">
21-
<!--Define the WINDOWS_UWP conditional symbol, since the Windows.Data.Xml and the Windows.UI.Notification namespaces are available-->
22-
<DefineConstants>$(DefineConstants);WINDOWS_UWP;WIN32</DefineConstants>
23-
</PropertyGroup>
24-
25-
<!--NET Core desktop apps also need the Registry NuGet package and System.Reflection.Emit for generating COM class dynamically-->
26-
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0-windows10.0.17763.0'">
27-
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
28-
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
29-
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
30-
</ItemGroup>
31-
32-
<ItemGroup Condition=" '$(TargetFramework)' == 'native' ">
33-
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="$(ExtrasUwpMetaPackageVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
34-
</ItemGroup>
35-
36-
<!-- In order to support .NET Native, we need to include an appropriate .rd.xml for UWP (remove from everything else) -->
37-
<ItemGroup Condition="'$(TargetFramework)' != 'uap10.0.19041' and '$(TargetFramework)' != 'native'">
38-
<EmbeddedResource Remove="Properties\Microsoft.Toolkit.Uwp.Notifications.rd.xml" />
39-
</ItemGroup>
40-
41-
<ItemGroup>
42-
<None Include="Microsoft.Toolkit.Uwp.Notifications.targets" Pack="true" PackagePath="build\native" />
43-
</ItemGroup>
44-
45-
<!--Native (C++) doesn't need System.ValueTuple (plus it's incompatible with this package)-->
46-
<ItemGroup Condition=" '$(TargetFramework)' != 'native' ">
47-
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
48-
</ItemGroup>
49-
509
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.19041'">
5110
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
5211
<DefaultTargetPlatformMinVersion>16299</DefaultTargetPlatformMinVersion>
5312
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
5413
</PropertyGroup>
5514

15+
<PropertyGroup Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0-windows10.0.17763.0'">
16+
<!-- Define the WINDOWS_UWP conditional symbol, since the Windows.Data.Xml and the Windows.UI.Notification namespaces are available -->
17+
<DefineConstants>$(DefineConstants);WINDOWS_UWP;WIN32</DefineConstants>
18+
</PropertyGroup>
19+
5620
<PropertyGroup Condition="'$(TargetFramework)' == 'native'">
5721
<OutputType>winmdobj</OutputType>
5822
<DebugType>Full</DebugType>
@@ -64,17 +28,49 @@
6428
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
6529
<DefaultTargetPlatformMinVersion>10240</DefaultTargetPlatformMinVersion>
6630
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
67-
<DefineConstants Condition="'$(DisableImplicitFrameworkDefines)' != 'true'">$(DefineConstants);NETFX_CORE;WINDOWS_UWP;WINRT</DefineConstants>
31+
<DefineConstants Condition="'$(DisableImplicitFrameworkDefines)' != 'true'">$(DefineConstants);WINDOWS_UWP;WINRT</DefineConstants>
6832
<CopyLocalLockFileAssemblies Condition="'$(CopyLocalLockFileAssemblies)' == ''">false</CopyLocalLockFileAssemblies>
6933
<TargetFrameworkIdentifier>.NETCore</TargetFrameworkIdentifier>
7034
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
7135
<LanguageTargets>$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v16.0\Microsoft.Windows.UI.Xaml.CSharp.targets</LanguageTargets>
36+
<ExtrasImplicitPlatformPackageIsPrivate>true</ExtrasImplicitPlatformPackageIsPrivate>
7237

7338
<!-- Need to override the built-in implicit defines for UAP or it'll be NETCORE5_0. This makes it UAP10_0_10240_0 to match the rest -->
7439
<ImplicitFrameworkDefine Condition="'$(DisableImplicitFrameworkDefines)' != 'true'">UAP$(TargetPlatformMinVersion.Replace('.', '_'))</ImplicitFrameworkDefine>
7540
<DisableImplicitFrameworkDefines Condition="'$(DisableImplicitFrameworkDefines)' != 'true'">true</DisableImplicitFrameworkDefines>
7641
</PropertyGroup>
7742

43+
<ItemGroup>
44+
<None Include="Microsoft.Toolkit.Uwp.Notifications.targets" Pack="true" PackagePath="build\native" />
45+
</ItemGroup>
46+
47+
<!-- In order to support .NET Native, we need to include an appropriate .rd.xml for UWP (remove from everything else) -->
48+
<ItemGroup Condition="'$(TargetFramework)' != 'uap10.0.19041' and '$(TargetFramework)' != 'native'">
49+
<EmbeddedResource Remove="Properties\Microsoft.Toolkit.Uwp.Notifications.rd.xml" />
50+
</ItemGroup>
51+
52+
<!-- Desktop Win32 apps -->
53+
<ItemGroup Condition="'$(TargetFramework)' == 'net461' or '$(TargetFramework)' == 'netcoreapp3.1'">
54+
<!-- Reference Windows SDK NuGet of correct target platform version -->
55+
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
56+
</ItemGroup>
57+
58+
<!-- The .NET Core desktop apps also need the Registry NuGet package and System.Reflection.Emit for generating COM class dynamically -->
59+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0-windows10.0.17763.0'">
60+
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
61+
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" />
62+
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
63+
</ItemGroup>
64+
65+
<ItemGroup Condition="'$(TargetFramework)' == 'native'">
66+
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="$(ExtrasUwpMetaPackageVersion)" PrivateAssets="All" IsImplicitlyDefined="true" />
67+
</ItemGroup>
68+
69+
<!-- Native (C++) doesn't need 'System.ValueTuple' (plus it's incompatible with this package) -->
70+
<ItemGroup Condition="'$(TargetFramework)' != 'native'">
71+
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
72+
</ItemGroup>
73+
7874
<!-- Set the nuspec properties. Dependent on version which isn't updated till after 'GetBuildVersion'. Condition ensures we only set once since this runs multiple times for each target. -->
7975
<Target Name="SetNuspecProperties" AfterTargets="GetBuildVersion">
8076
<PropertyGroup Condition="'$(NuspecProperties)' == ''">

Microsoft.Toolkit.Uwp.UI.Behaviors/Microsoft.Toolkit.Uwp.UI.Behaviors.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27+
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI\Microsoft.Toolkit.Uwp.UI.csproj" />
2728
<!-- TODO: Including Animation reference for now for initial refactor of the ScrollHeader behaviors, we may be able to remove, but may also have some Behaviors for Animations? -->
2829
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI.Animations\Microsoft.Toolkit.Uwp.UI.Animations.csproj" />
29-
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.UI\Microsoft.Toolkit.Uwp.UI.csproj" />
3030
</ItemGroup>
3131

3232
</Project>

Microsoft.Toolkit/Microsoft.Toolkit.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<PackageTags>Windows;Community;Toolkit;WCT;UWP;Incremental;Loading;Collection;IncrementalLoadingCollection;String;Array;extensions;helpers</PackageTags>
1515
</PropertyGroup>
1616

17-
<!-- .NET Standard 1.4 doesn't have the [Pure] attribute -->
18-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.4' ">
19-
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
20-
</ItemGroup>
21-
2217
<!-- .NET Standard 2.1 and .NET 5 already have [NotNullIfNotNull] and [NotNullWhen] -->
2318
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'net5.0'">
2419
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
2520
</PropertyGroup>
2621

22+
<!-- .NET Standard 1.4 doesn't have the [Pure] attribute -->
23+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.4'">
24+
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
25+
</ItemGroup>
26+
2727
</Project>

UnitTests/UnitTests.UWP/Properties/UnitTestApp.rd.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<Type Name="Windows.UI.Xaml.Controls.FontIcon" Dynamic="Required All" Serialize="Required All" />
2828
<Type Name="Windows.UI.Xaml.Controls.BitmapIcon" Dynamic="Required All" Serialize="Required All" />
2929

30-
<Type Name="UnitTests.Extensions.MockSwipeItem" Dynamic="Required All" Serialize="Required All" />
30+
<Type Name="System.Collections.Generic.IList{Windows.UI.Xaml.Automation.Peers.AutomationPeer}" MarshalObject="Required All"/>
3131

3232
<Type Name="Microsoft.Toolkit.Uwp.UI.BitmapIconExtension" Dynamic="Required All" Serialize="Required All"/>
3333
<Type Name="Microsoft.Toolkit.Uwp.UI.FontIconExtension" Dynamic="Required All" Serialize="Required All"/>
@@ -36,6 +36,6 @@
3636
<Type Name="Microsoft.Toolkit.Uwp.UI.SymbolIconSourceExtension" Dynamic="Required All" Serialize="Required All"/>
3737
<Type Name="Microsoft.Toolkit.Uwp.UI.EnumValuesExtension" Dynamic="Required All" Serialize="Required All"/>
3838

39-
<Type Name="System.Collections.Generic.IList{Windows.UI.Xaml.Automation.Peers.AutomationPeer}" MarshalObject="Required All"/>
39+
<Type Name="UnitTests.Extensions.MockSwipeItem" Dynamic="Required All" Serialize="Required All" />
4040
</Application>
4141
</Directives>

0 commit comments

Comments
 (0)