Skip to content

Commit f248860

Browse files
committed
Refactor projects and its files
Consolidate common MSBuild logic Update Package title and description
1 parent e8029ec commit f248860

File tree

29 files changed

+255
-276
lines changed

29 files changed

+255
-276
lines changed

Directory.Build.props

Lines changed: 32 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,23 @@
11
<Project>
22

33
<PropertyGroup>
4-
<Authors>Microsoft.Toolkit</Authors>
5-
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
6-
<NoPackageAnalysis>true</NoPackageAnalysis>
7-
<PackageIconUrl>https://raw.githubusercontent.com/windows-toolkit/WindowsCommunityToolkit/main/build/nuget.png</PackageIconUrl>
8-
<PackageIcon>images\nuget.png</PackageIcon>
9-
<PackageProjectUrl>https://github.com/windows-toolkit/WindowsCommunityToolkit</PackageProjectUrl>
10-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
11-
<PackageReleaseNotes>https://github.com/windows-toolkit/WindowsCommunityToolkit/releases</PackageReleaseNotes>
12-
<Copyright>(c) .NET Foundation and Contributors. All rights reserved.</Copyright>
13-
<DefaultLanguage>en-US</DefaultLanguage>
14-
<IsDesignProject>$(MSBuildProjectName.Contains('.Design'))</IsDesignProject>
15-
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
16-
<IsUwpProject Condition="'$(IsDesignProject)' != 'true'">$(MSBuildProjectName.Contains('Uwp'))</IsUwpProject>
17-
<IsSampleProject>$(MSBuildProjectName.Contains('Sample'))</IsSampleProject>
18-
<TargetPlatformBaseVersion>10.0</TargetPlatformBaseVersion>
19-
<TargetPlatformRevision>19041</TargetPlatformRevision>
20-
<TargetPlatformMinRevision>17763</TargetPlatformMinRevision>
21-
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\nupkg</PackageOutputPath>
4+
<RepositoryDirectory>$(MSBuildThisFileDirectory)</RepositoryDirectory>
5+
<BuildToolsDirectory>$(RepositoryDirectory)build\</BuildToolsDirectory>
226
</PropertyGroup>
237

8+
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.Common.props" />
9+
2410
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
2511
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
2612
</PropertyGroup>
2713

2814
<Choose>
29-
<When Condition="'$(IsTestProject)' != 'true' and '$(IsSampleProject)' != 'true' and '$(IsDesignProject)' != 'true'">
15+
<When Condition="$(IsCoreProject)">
3016
<PropertyGroup>
3117
<GenerateDocumentationFile>true</GenerateDocumentationFile>
18+
<PackageOutputPath>$(RepositoryDirectory)bin\nupkg</PackageOutputPath>
19+
<GenerateLibraryLayout Condition="$(IsUwpProject)">true</GenerateLibraryLayout>
20+
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
3221
</PropertyGroup>
3322
</When>
3423
<Otherwise>
@@ -39,25 +28,43 @@
3928
</Choose>
4029

4130
<Choose>
42-
<When Condition="('$(IsUwpProject)' == 'true') and '$(IsSampleProject)' != 'true' and '$(IsDesignProject)' != 'true'">
31+
<When Condition="$(IsUwpProject)">
4332
<PropertyGroup>
44-
<GenerateLibraryLayout>true</GenerateLibraryLayout>
33+
<!-- Code 8002 is a warning for strong named -> non-strong-named reference. This is valid for platforms other than .NET Framework (and is needed for the UWP targets. -->
34+
<NoWarn>$(NoWarn);8002</NoWarn>
4535
</PropertyGroup>
36+
<ItemGroup>
37+
<EmbeddedResource Include="**\*.rd.xml" />
38+
<Page Include="**\*.xaml" Exclude="**\bin\**\*.xaml;**\obj\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
39+
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
40+
</ItemGroup>
4641
</When>
4742
</Choose>
4843

4944
<Choose>
50-
<When Condition="'$(Configuration)' == 'Debug' and '$(IsDesignProject)' != 'true'">
51-
<!-- Debug builds have this turned on by default, but it breaks our Xaml Islands Scenarios -->
52-
<PropertyGroup>
45+
<When Condition="!$(IsDesignProject)">
46+
<!--
47+
Debug builds have this turned on by default, but it breaks our Xaml Islands Scenarios.
48+
ARM64 builds for managed apps use .NET Native. We can't use the Reflection Provider for that.
49+
-->
50+
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
5351
<EnableXBindDiagnostics>false</EnableXBindDiagnostics>
5452
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
5553
</PropertyGroup>
54+
<ItemGroup>
55+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
56+
</ItemGroup>
5657
</When>
5758
</Choose>
5859

60+
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.VisualStudio.Design.props" Condition="$(IsDesignProject)" />
61+
62+
<ItemGroup>
63+
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="All" />
64+
</ItemGroup>
65+
5966
<Choose>
60-
<When Condition="'$(SourceLinkEnabled)' != 'false' and '$(IsSampleProject)' != 'true'">
67+
<When Condition="!$(IsSampleProject) and '$(SourceLinkEnabled)' != 'false'">
6168
<PropertyGroup>
6269
<!-- Declare that the Repository URL can be published to NuSpec -->
6370
<PublishRepositoryUrl>true</PublishRepositoryUrl>
@@ -73,45 +80,4 @@
7380
</When>
7481
</Choose>
7582

76-
<Choose>
77-
<When Condition="'$(IsDesignProject)' != 'true'">
78-
<ItemGroup>
79-
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
80-
</ItemGroup>
81-
</When>
82-
</Choose>
83-
84-
<Choose>
85-
<When Condition="'$(IsTestProject)' != 'true' and '$(IsSampleProject)' != 'true' and '$(IsDesignProject)' != 'true'">
86-
<ItemGroup>
87-
<EmbeddedResource Include="**\*.rd.xml" />
88-
<Page Include="**\*.xaml" Exclude="**\bin\**\*.xaml;**\obj\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
89-
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
90-
</ItemGroup>
91-
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
92-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
93-
</PropertyGroup>
94-
</When>
95-
</Choose>
96-
97-
<PropertyGroup Condition="'$(IsUwpProject)' == 'true'">
98-
<!-- 8002 is a strong named -> non-strong-named reference -->
99-
<!-- This is valid for platforms other than .NET Framework (and is needed for the UWP targets -->
100-
<NoWarn>$(NoWarn);8002</NoWarn>
101-
</PropertyGroup>
102-
103-
<ItemGroup>
104-
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" />
105-
</ItemGroup>
106-
107-
<ItemGroup>
108-
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json">
109-
<Link>stylecop.json</Link>
110-
</AdditionalFiles>
111-
<None Include="$(MSBuildThisFileDirectory)License.md" Pack="true" PackagePath="\" />
112-
<None Include="$(MSBuildThisFileDirectory)build\nuget.png" Pack="true" PackagePath="images\" />
113-
</ItemGroup>
114-
115-
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.VisualStudio.Design.props" Condition="'$(IsDesignProject)' == 'true'" />
116-
11783
</Project>

Directory.Build.targets

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
<Project>
22

33
<PropertyGroup>
4-
<UseUWP Condition="$(TargetFramework.Contains(`uap10.0`)) or '$(TargetFramework)' == 'net461'">true</UseUWP>
4+
<!-- Exclude Notifications project from this since it sets different min versions than what we want for notifications -->
5+
<UseUWP Condition="($(TargetFramework.StartsWith('uap10.0')) or '$(TargetFramework)' == 'net461') and '$(MSBuildProjectName)' != 'Microsoft.Toolkit.Uwp.Notifications'">true</UseUWP>
56
</PropertyGroup>
67

78
<Choose>
89
<!-- We'll include signing the Notifications library since we need the DLL signature to match for interop from class libraries to main projects -->
9-
<When Condition="(!$(TargetFramework.Contains(`uap10.0`)) and '$(TargetFramework)' != 'native' and '$(IsSampleProject)' != 'true') or $(MSBuildProjectName) == 'Microsoft.Toolkit.Uwp.Notifications'">
10+
<When Condition="!($(TargetFramework.StartsWith('uap10.0')) or '$(TargetFramework)' == 'native' or '$(IsSampleProject)' == 'true') or '$(MSBuildProjectName)' == 'Microsoft.Toolkit.Uwp.Notifications'">
1011
<PropertyGroup>
1112
<SignAssembly>true</SignAssembly>
1213
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)toolkit.snk</AssemblyOriginatorKeyFile>
1314
</PropertyGroup>
1415
</When>
1516
</Choose>
1617

17-
<!--Exclude Notifications project from this since it sets different min versions than what we want for notifications-->
18-
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.Uwp.Build.targets" Condition="'$(UseUWP)' == 'true' and $(MSBuildProjectName) != 'Microsoft.Toolkit.Uwp.Notifications'" />
18+
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.Uwp.Build.targets" Condition="'$(UseUWP)' == 'true'" />
19+
20+
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.Workarounds.Xaml.targets" Condition="'$(IsCoreProject)' == 'true' and '$(GenerateDocumentationFile)' == 'true'" />
1921

2022
<Target Name="AddCommitHashToAssemblyAttributes" BeforeTargets="GetAssemblyAttributes">
2123
<ItemGroup>

Microsoft.Toolkit.Diagnostics/Microsoft.Toolkit.Diagnostics.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard1.4;netstandard2.0;netstandard2.1;net5.0</TargetFrameworks>
5-
<LangVersion>9.0</LangVersion>
4+
<Nullable>Enable</Nullable>
65
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
7-
<Nullable>enable</Nullable>
6+
<TargetFrameworks>netstandard1.4;netstandard2.0;netstandard2.1;net5.0</TargetFrameworks>
7+
</PropertyGroup>
8+
9+
<PropertyGroup>
810
<Title>Windows Community Toolkit Diagnostics .NET Standard</Title>
911
<Description>
1012
This package includes .NET Standard code only helpers such as:

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard1.4;netstandard2.0;netstandard2.1;netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
5-
<LangVersion>9.0</LangVersion>
6-
<Nullable>enable</Nullable>
4+
<Nullable>Enable</Nullable>
75
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6+
<TargetFrameworks>netstandard1.4;netstandard2.0;netstandard2.1;netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
7+
</PropertyGroup>
8+
9+
<PropertyGroup>
810
<Title>Windows Community Toolkit High Performance .NET Standard</Title>
911
<Description>
1012
This package includes high performance .NET Standard helpers such as:

Microsoft.Toolkit.Mvvm/Microsoft.Toolkit.Mvvm.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0</TargetFrameworks>
5-
<LangVersion>9.0</LangVersion>
6-
<Nullable>enable</Nullable>
4+
<Nullable>Enable</Nullable>
75
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6+
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0</TargetFrameworks>
7+
</PropertyGroup>
8+
9+
<PropertyGroup>
810
<Title>Windows Community Toolkit MVVM Toolkit</Title>
911
<Description>
1012
This package includes a .NET Standard MVVM library with helpers such as:

Microsoft.Toolkit.Uwp.Connectivity/Microsoft.Toolkit.Uwp.Connectivity.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<Project Sdk="MSBuild.Sdk.Extras">
22

33
<PropertyGroup>
4-
<TargetFrameworks>uap10.0.17763</TargetFrameworks>
4+
<TargetFramework>uap10.0.17763</TargetFramework>
5+
</PropertyGroup>
6+
7+
<PropertyGroup>
58
<Title>Windows Community Toolkit Devices</Title>
69
<Description>This library enables easier consumption of connectivity Devices/Peripherals and handle its connection to Windows devices. It contains BluetoothLE and Network connectivity helpers.</Description>
710
<PackageTags>Windows;Community;Toolkit;WCT;UWP;Devices;Bluetooth;LE;BluetoothLE;BLE;Networking</PackageTags>
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<Project Sdk="MSBuild.Sdk.Extras">
22

33
<PropertyGroup>
4-
<TargetFrameworks>uap10.0.17763</TargetFrameworks>
4+
<TargetFramework>uap10.0.17763</TargetFramework>
5+
</PropertyGroup>
6+
7+
<PropertyGroup>
58
<Title>Windows Community Toolkit Developer Tools</Title>
6-
<Description>This library provides XAML user controls and services to help developers build their app. It is part of the Windows Community Toolkit.
9+
<Description>This library provides XAML user controls and services to help developers build their app. It is a part of the Windows Community Toolkit.
710

811
-AligmentGrid : Displays a Grid that helps align the controls.
912
-FocusTrackerControl : The FocusTracker Control is a feature that can be used to display information about the current focused XAML element.
@@ -16,13 +19,4 @@
1619
<None Include="VisualStudioToolsManifest.xml" Pack="true" PackagePath="tools" />
1720
</ItemGroup>
1821

19-
<!-- https://weblogs.asp.net/rweigelt/disable-warnings-in-generated-c-files-of-uwp-app -->
20-
<Target Name="PragmaWarningDisablePrefixer" AfterTargets="MarkupCompilePass2">
21-
<ItemGroup>
22-
<GeneratedCSFiles Include="**\*.g.cs;**\*.g.i.cs" />
23-
</ItemGroup>
24-
<Message Text="CSFiles: @(GeneratedCSFiles->'&quot;%(Identity)&quot;')" />
25-
<Exec Command="for %%f in (@(GeneratedCSFiles->'&quot;%(Identity)&quot;')) do echo #pragma warning disable &gt; %%f.temp &amp;&amp; type %%f &gt;&gt; %%f.temp &amp;&amp; move /y %%f.temp %%f &gt; NUL" />
26-
</Target>
27-
2822
</Project>

Microsoft.Toolkit.Uwp.Input.GazeInteraction/Microsoft.Toolkit.Uwp.Input.GazeInteraction.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
<PropertyGroup>
44
<TargetFramework>uap10.0.17134</TargetFramework>
5+
<RootNamespace>Microsoft.Toolkit.Uwp.Input</RootNamespace>
6+
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
7+
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
8+
</PropertyGroup>
9+
10+
<PropertyGroup>
511
<Title>Windows Community Toolkit Eye Gaze Library</Title>
612
<Description>A library to integrate gaze interactions using eye trackers into UWP applications</Description>
713
<PackageTags>Windows;Community;Toolkit;WCT;UWP;Gaze;Eye;Tracker;EyeTracker</PackageTags>
8-
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
9-
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
1014
</PropertyGroup>
1115

1216
</Project>

Microsoft.Toolkit.Uwp.Notifications/Properties/Microsoft.Toolkit.Uwp.Notifications.rd.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--
2-
This file enable reflections for Toolkit.Notifications and all of its public/private members,
3-
enabling the library to work in .NET Native even if developers modified their default rd.xml.
2+
This file enables reflection for 'Uwp.Notifications' and all of its public/private members.
3+
Thus, making the library to work in .NET Native, even if developers modified their default rd.xml.
44
See issue https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3093 for more details.
55
-->
66
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">

Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,14 +1539,6 @@
15391539
</AppxPackagePayload>
15401540
</ItemGroup>
15411541
</Target>
1542-
<!-- https://weblogs.asp.net/rweigelt/disable-warnings-in-generated-c-files-of-uwp-app -->
1543-
<Target Name="PragmaWarningDisablePrefixer" AfterTargets="MarkupCompilePass2">
1544-
<ItemGroup>
1545-
<GeneratedCSFiles Include="**\*.g.cs;**\*.g.i.cs" />
1546-
</ItemGroup>
1547-
<Message Text="CSFiles: @(GeneratedCSFiles->'&quot;%(Identity)&quot;')" />
1548-
<Exec Command="for %%f in (@(GeneratedCSFiles->'&quot;%(Identity)&quot;')) do echo #pragma warning disable &gt; %%f.temp &amp;&amp; type %%f | findstr /v /b &quot;#pragma&quot; &gt;&gt; %%f.temp &amp;&amp; move /y %%f.temp %%f &gt; NUL" />
1549-
</Target>
15501542
<!-- No-op to avoid build error when packing solution from commandline -->
15511543
<Target Name="Pack" />
15521544
</Project>

0 commit comments

Comments
 (0)