Skip to content

Commit ccaf0ec

Browse files
committed
Consolidate Build logic — Design projects only
Rename Platform version to revision — after all that's what it is! Introduce PlatformBaseVersion to hold '10.0' Move UWP specific logic to its own targets
1 parent 65af703 commit ccaf0ec

File tree

8 files changed

+54
-59
lines changed

8 files changed

+54
-59
lines changed

Directory.Build.props

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
1515
<IsUwpProject Condition="'$(IsDesignProject)' != 'true'">$(MSBuildProjectName.Contains('Uwp'))</IsUwpProject>
1616
<IsSampleProject>$(MSBuildProjectName.Contains('Sample'))</IsSampleProject>
17-
<DefaultTargetPlatformVersion>19041</DefaultTargetPlatformVersion>
18-
<DefaultTargetPlatformMinVersion>17763</DefaultTargetPlatformMinVersion>
17+
<TargetPlatformBaseVersion>10.0</TargetPlatformBaseVersion>
18+
<TargetPlatformRevision>19041</TargetPlatformRevision>
19+
<TargetPlatformMinRevision>17763</TargetPlatformMinRevision>
1920
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\nupkg</PackageOutputPath>
2021
</PropertyGroup>
2122

@@ -88,7 +89,6 @@
8889
</Choose>
8990

9091
<PropertyGroup Condition="'$(IsUwpProject)' == 'true'">
91-
9292
<!-- 8002 is a strong named -> non-strong-named reference -->
9393
<!-- This is valid for platforms other than .NET Framework (and is needed for the UWP targets -->
9494
<NoWarn>$(NoWarn);8002</NoWarn>
@@ -103,4 +103,5 @@
103103
<Link>stylecop.json</Link>
104104
</AdditionalFiles>
105105
</ItemGroup>
106+
106107
</Project>

Directory.Build.targets

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
11
<Project>
2-
<Choose>
3-
<When Condition="'$(TargetFramework)' == 'uap10.0' or '$(TargetFramework)' == 'uap10.0.17763' or '$(TargetFramework)' == 'native' or '$(TargetFramework)' == 'net461'">
4-
<!-- UAP versions for uap10.0 where TPMV isn't implied -->
5-
<PropertyGroup>
6-
<TargetPlatformVersion>10.0.$(DefaultTargetPlatformVersion).0</TargetPlatformVersion>
7-
<TargetPlatformMinVersion>10.0.$(DefaultTargetPlatformMinVersion).0</TargetPlatformMinVersion>
8-
</PropertyGroup>
92

10-
<PropertyGroup Condition="'$(DebugType)' == ''">
11-
<DebugType>Portable</DebugType>
12-
</PropertyGroup>
3+
<PropertyGroup>
4+
<UseUWP Condition="'$(TargetFramework)' == 'uap10.0' or '$(TargetFramework)' == 'uap10.0.17763' or '$(TargetFramework)' == 'native' or '$(TargetFramework)' == 'net461'">true</UseUWP>
5+
</PropertyGroup>
136

14-
<ItemGroup>
15-
<SDKReference Condition="'$(UseWindowsDesktopSdk)' == 'true' " Include="WindowsDesktop, Version=$(TargetPlatformVersion)">
16-
<Name>Windows Desktop Extensions for the UWP</Name>
17-
</SDKReference>
18-
</ItemGroup>
19-
</When>
20-
</Choose>
21-
227
<Choose>
23-
<When Condition="'$(TargetFramework.Contains(`uap10.0`))' == 'false' and '$(TargetFramework)' != 'native' and '$(IsSampleProject)' != 'true'">
8+
<When Condition="!$(TargetFramework.Contains(`uap10.0`)) and '$(TargetFramework)' != 'native' and '$(IsSampleProject)' != 'true'">
249
<PropertyGroup>
2510
<SignAssembly>true</SignAssembly>
2611
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)toolkit.snk</AssemblyOriginatorKeyFile>
2712
</PropertyGroup>
2813
</When>
2914
</Choose>
3015

16+
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.Uwp.Build.targets" Condition="'$(UseUWP)' == 'true'"/>
17+
3118
<Target Name="AddCommitHashToAssemblyAttributes" BeforeTargets="GetAssemblyAttributes">
3219
<ItemGroup>
3320
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition=" '$(SourceRevisionId)' != '' ">
@@ -36,4 +23,5 @@
3623
</AssemblyAttribute>
3724
</ItemGroup>
3825
</Target>
26+
3927
</Project>

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.Design/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.Design.csproj

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,17 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>Microsoft.Toolkit.Uwp.UI.Controls.Design</RootNamespace>
1111
<AssemblyName>Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.Design</AssemblyName>
12-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1312
<FileAlignment>512</FileAlignment>
14-
<TargetFrameworkProfile />
15-
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
16-
</PropertyGroup>
17-
<PropertyGroup>
1813
<TargetPlatformVersion>8.1</TargetPlatformVersion>
14+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
15+
<ValidateFrameworkCompatibility>false</ValidateFrameworkCompatibility>
1916
</PropertyGroup>
2017
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
2118
<DebugSymbols>true</DebugSymbols>
2219
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\Debug\uap10.0.17763\Design\</OutputPath>
2320
<DebugType>full</DebugType>
2421
<Optimize>false</Optimize>
25-
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<DefineConstants>TRACE;DEBUG</DefineConstants>
2623
<PlatformTarget>x86</PlatformTarget>
2724
</PropertyGroup>
2825
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
@@ -33,7 +30,7 @@
3330
<DefineConstants>TRACE</DefineConstants>
3431
</PropertyGroup>
3532
<PropertyGroup>
36-
<ValidateFrameworkCompatibility>false</ValidateFrameworkCompatibility>
33+
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
3734
</PropertyGroup>
3835
<ItemGroup>
3936
<Reference Include="System.Runtime" />
@@ -110,7 +107,6 @@
110107
</EmbeddedResource>
111108
</ItemGroup>
112109
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
113-
<Target Name="Pack">
114-
<!-- No-op to avoid build error when packing solution from commandline -->
115-
</Target>
110+
<!-- No-op to avoid build error when packing solution from commandline -->
111+
<Target Name="Pack" />
116112
</Project>

Microsoft.Toolkit.Uwp.UI.Controls.Design/Microsoft.Toolkit.Uwp.UI.Controls.Design.csproj

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,17 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>Microsoft.Toolkit.Uwp.UI.Controls.Design</RootNamespace>
1111
<AssemblyName>Microsoft.Toolkit.Uwp.UI.Controls.Design</AssemblyName>
12-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1312
<FileAlignment>512</FileAlignment>
14-
<TargetFrameworkProfile />
15-
<NoWarn>$(NoWarn);0618</NoWarn>
16-
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
17-
</PropertyGroup>
18-
<PropertyGroup>
1913
<TargetPlatformVersion>8.1</TargetPlatformVersion>
14+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
15+
<ValidateFrameworkCompatibility>false</ValidateFrameworkCompatibility>
2016
</PropertyGroup>
2117
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
2218
<DebugSymbols>true</DebugSymbols>
2319
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls\bin\Debug\uap10.0.17763\Design\</OutputPath>
2420
<DebugType>full</DebugType>
2521
<Optimize>false</Optimize>
26-
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<DefineConstants>TRACE;DEBUG</DefineConstants>
2723
<PlatformTarget>x86</PlatformTarget>
2824
</PropertyGroup>
2925
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
@@ -34,7 +30,8 @@
3430
<DefineConstants>TRACE</DefineConstants>
3531
</PropertyGroup>
3632
<PropertyGroup>
37-
<ValidateFrameworkCompatibility>false</ValidateFrameworkCompatibility>
33+
<NoWarn>$(NoWarn);0618</NoWarn>
34+
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
3835
</PropertyGroup>
3936
<ItemGroup>
4037
<Reference Include="System.Runtime" />
@@ -137,7 +134,6 @@
137134
<EmbeddedResource Include="Icons\Microsoft.Toolkit.Uwp.UI.Controls.RotatorTile.icon.png" />
138135
</ItemGroup>
139136
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
140-
<Target Name="Pack">
141-
<!-- No-op to avoid build error when packing solution from commandline -->
142-
</Target>
137+
<!-- No-op to avoid build error when packing solution from commandline -->
138+
<Target Name="Pack" />
143139
</Project>

Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Design/Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Design.csproj

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,17 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>Microsoft.Toolkit.Uwp.UI.Controls.Design</RootNamespace>
1111
<AssemblyName>Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Design</AssemblyName>
12-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1312
<FileAlignment>512</FileAlignment>
14-
<TargetFrameworkProfile />
15-
<NoWarn>$(NoWarn);0618</NoWarn>
16-
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
17-
</PropertyGroup>
18-
<PropertyGroup>
1913
<TargetPlatformVersion>8.1</TargetPlatformVersion>
14+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
15+
<ValidateFrameworkCompatibility>false</ValidateFrameworkCompatibility>
2016
</PropertyGroup>
2117
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
2218
<DebugSymbols>true</DebugSymbols>
2319
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.Markdown\bin\Debug\uap10.0.17763\Design\</OutputPath>
2420
<DebugType>full</DebugType>
2521
<Optimize>false</Optimize>
26-
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<DefineConstants>TRACE;DEBUG</DefineConstants>
2723
<PlatformTarget>x86</PlatformTarget>
2824
</PropertyGroup>
2925
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
@@ -34,7 +30,7 @@
3430
<DefineConstants>TRACE</DefineConstants>
3531
</PropertyGroup>
3632
<PropertyGroup>
37-
<ValidateFrameworkCompatibility>false</ValidateFrameworkCompatibility>
33+
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
3834
</PropertyGroup>
3935
<ItemGroup>
4036
<Reference Include="System.Runtime" />
@@ -111,7 +107,6 @@
111107
</EmbeddedResource>
112108
</ItemGroup>
113109
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
114-
<Target Name="Pack">
115-
<!-- No-op to avoid build error when packing solution from commandline -->
116-
</Target>
110+
<!-- No-op to avoid build error when packing solution from commandline -->
111+
<Target Name="Pack" />
117112
</Project>

SmokeTests/SmokeTest.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
<AssemblyName>SmokeTest.$(CurrentProject)</AssemblyName>
1818
<DefaultLanguage>en-US</DefaultLanguage>
1919
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
20-
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.$(DefaultTargetPlatformVersion).0</TargetPlatformVersion>
21-
<TargetPlatformMinVersion>10.0.$(DefaultTargetPlatformMinVersion).0</TargetPlatformMinVersion>
20+
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.$(TargetPlatformRevision).0</TargetPlatformVersion>
21+
<TargetPlatformMinVersion>10.0.$(TargetPlatformMinRevision).0</TargetPlatformMinVersion>
2222
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
2323
<FileAlignment>512</FileAlignment>
2424
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

build/Find-WindowsSDKVersions.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ function Get-SdkVersion
5757
$versions.Add($version) | Out-Null
5858

5959
# Versions may also be specified without the 10.0.xxxxx.0 format in the
60-
# PropertyGroup/DefaultTargetPlatformVersion and PropertyGroup/DefaultTargetPlatformMinVersion
60+
# PropertyGroup/TargetPlatformRevision and PropertyGroup/TargetPlatformMinRevision
6161

6262
# If you want a complete set of SDKs that are required, uncomment the following
63-
# $version = Get-NodeValue $xml 'PropertyGroup/DefaultTargetPlatformMinVersion'
63+
# $version = Get-NodeValue $xml 'PropertyGroup/TargetPlatformMinRevision'
6464
# $versions.Add("10.0." + $version + ".0") | Out-Null
6565

66-
$version = Get-NodeValue $xml 'PropertyGroup/DefaultTargetPlatformVersion'
66+
$version = Get-NodeValue $xml 'PropertyGroup/TargetPlatformRevision'
6767
$versions.Add("10.0." + $version + ".0") | Out-Null
6868
}
6969

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project>
2+
3+
<!-- 'TargetPlatform*Version' for uap10.0 where TPMV isn't implied -->
4+
<PropertyGroup>
5+
<TargetPlatformVersion>$(TargetPlatformBaseVersion).$(TargetPlatformRevision).0</TargetPlatformVersion>
6+
<TargetPlatformMinVersion>$(TargetPlatformBaseVersion).$(TargetPlatformMinRevision).0</TargetPlatformMinVersion>
7+
<DebugType Condition="'$(DebugType)' == ''">Portable</DebugType>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<SDKReference Include="WindowsDesktop, Version=$(TargetPlatformVersion)" Condition="'$(UseWindowsDesktopSdk)' == 'true'">
12+
<Name>Windows Desktop Extensions for the UWP</Name>
13+
</SDKReference>
14+
<SDKReference Include="WindowsMobile, Version=$(TargetPlatformVersion)" Condition="'$(UseWindowsMobileSdk)' == 'true'">
15+
<Name>Windows Mobile Extensions for the UWP</Name>
16+
</SDKReference>
17+
</ItemGroup>
18+
19+
</Project>

0 commit comments

Comments
 (0)