Skip to content

Commit 6303c67

Browse files
committed
Optimize UITests Shared project's item includes
Remove redundant 'Exclude' as bin/obj doesn't exist in the Shared project. We use None to include items to be visible under the Shared Project in VS IDE. But having both None and Compile/Page includes for the same files will impact Build and IDE perf. So, Only include None when Compile/Page is already active.
1 parent 8ed1caa commit 6303c67

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

UITests/UITests.Tests.Shared/UITests.Tests.Shared.projitems

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,47 @@
1111
<!-- When we're in the test harness include all '*Test.cs' files -->
1212
<When Condition="'$(IsTestHarness)' == 'true'">
1313
<ItemGroup>
14-
<Compile Include="$(MSBuildThisFileDirectory)**\*Test.cs" Exclude="**\bin\**\*Test.cs;**\obj\**\*Test.cs" />
14+
<Compile Include="$(MSBuildThisFileDirectory)**\*Test.cs" />
1515
<!-- Base test helpers -->
1616
<Compile Include="$(MSBuildThisFileDirectory)UITestBase.cs" />
1717
<Compile Include="$(MSBuildThisFileDirectory)TestAssembly.cs" />
1818
<Compile Include="$(MSBuildThisFileDirectory)TestPageAttribute.cs" />
1919
<Compile Include="$(MSBuildThisFileDirectory)VisualTreeHelper.cs" />
2020
</ItemGroup>
2121
</When>
22+
<!-- Have a None Include as well to make all items visible under this Shared Project in VS IDE -->
23+
<Otherwise>
24+
<ItemGroup>
25+
<None Include="$(MSBuildThisFileDirectory)**\*Test.cs" />
26+
<!-- Base test helpers -->
27+
<None Include="$(MSBuildThisFileDirectory)UITestBase.cs" />
28+
<None Include="$(MSBuildThisFileDirectory)TestAssembly.cs" />
29+
<None Include="$(MSBuildThisFileDirectory)TestPageAttribute.cs" />
30+
<None Include="$(MSBuildThisFileDirectory)VisualTreeHelper.cs" />
31+
</ItemGroup>
32+
</Otherwise>
2233
</Choose>
2334
<Choose>
2435
<!-- When we're in the UI app used by the test harness, include all the pages -->
2536
<When Condition="'$(IsTestHost)' == 'true'">
2637
<ItemGroup>
27-
<Page Include="$(MSBuildThisFileDirectory)**\*Page.xaml" Exclude="**\bin\**\*Page.xaml;**\obj\**\*Page.xaml" Link="%(RecursiveDir)%(FileName)%(Extension)" SubType="Designer" Generator="MSBuild:Compile" />
28-
<Compile Include="$(MSBuildThisFileDirectory)**\*Page.xaml.cs" DependentUpon="%(Filename)" />
38+
<Page Include="$(MSBuildThisFileDirectory)**\*Page.xaml" SubType="Designer" Generator="MSBuild:Compile">
39+
<!--
40+
HACK: See Microsoft.Windows.UI.Xaml.Common.targets(540) for how XAML targets calculate 'xbf' output paths.
41+
Without this 'Link' attribute, XAML targets use absolute path instead of relative path for 'xbf' compilation.
42+
Thus, the build errors out with 'MSB4023' code without the 'Link' attribute below.
43+
-->
44+
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
45+
</Page>
46+
<Compile Include="$(MSBuildThisFileDirectory)**\*Page.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
2947
</ItemGroup>
3048
</When>
49+
<!-- Have a None Include as well to make all items visible under this Shared Project in VS IDE -->
50+
<Otherwise>
51+
<ItemGroup>
52+
<None Include="$(MSBuildThisFileDirectory)**\*Page.xaml" SubType="Designer" Generator="MSBuild:Compile" />
53+
<None Include="$(MSBuildThisFileDirectory)**\*Page.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
54+
</ItemGroup>
55+
</Otherwise>
3156
</Choose>
32-
<!-- Have a None Include as well to make all items visible in VS in the Shared Project -->
33-
<ItemGroup>
34-
<None Include="$(MSBuildThisFileDirectory)**\*Test.cs" Exclude="**\bin\**\*Test.cs;**\obj\**\*Test.cs" />
35-
<None Include="$(MSBuildThisFileDirectory)**\*Page.xaml" Exclude="**\bin\**\*Page.xaml;**\obj\**\*Page.xaml" SubType="Designer" Generator="MSBuild:Compile" />
36-
<None Include="$(MSBuildThisFileDirectory)**\*Page.xaml.cs" DependentUpon="%(Filename)" />
37-
<!-- Base test helpers -->
38-
<None Include="$(MSBuildThisFileDirectory)UITestBase.cs" />
39-
<None Include="$(MSBuildThisFileDirectory)TestAssembly.cs" />
40-
<None Include="$(MSBuildThisFileDirectory)TestPageAttribute.cs" />
41-
<None Include="$(MSBuildThisFileDirectory)VisualTreeHelper.cs" />
42-
</ItemGroup>
4357
</Project>

0 commit comments

Comments
 (0)