Skip to content

Commit 0212a4e

Browse files
authored
Remove NetCoreReference (#9914)
* Remove NetCoreReference This removes the `NetCoreReference` infrastructure and replaces it with `DefaultReferenceExclusion` to remove the one problematic implicit reference to WindowsBase. Manually picking references was blocking using System.Private.Windows.Core from the WinForms repo. Not having this also greatly simplifies the projects. This also tweaks the solution to add folders docs and eng items. Fixes #9168 * Put back test projects in solution
1 parent 7d7f092 commit 0212a4e

File tree

61 files changed

+112
-1682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+112
-1682
lines changed

Documentation/LocalMarkupCompilation.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,4 @@ It can be enabled for a project by setting this:
3737
In addition to these, care must be taken for the following:
3838

3939
- Use `<EmbeddedResource>` instead of `<Resource>`
40-
- `PresentationBuildTask` will strip out `<Resource>` items during `_CompileTemporaryAssembly` phase. Using `EmbeddedResource` is equivalent (esp. in for `Xlf` based string resource generation with `Arcade.Sdk`) and will not be adversely affected by `PresentationBuildTasks` transformations.
41-
- Always use `<NetCoreReference>` instead of implicitly acquiring the full set of `Microsoft.NetCore.App` references.
42-
- `Microsoft.NetCore.App` contains a version `WindowsBase` that clashes with WPF's `WindowsBase` during markup compilation.
43-
- To avoid this clash, we must always specify the references we need explicitly.
44-
- Also, our code-base requires that all references be specified explicitly anyway to avoid inadvertent reference-creep to bug-fixes.
40+
- `PresentationBuildTask` will strip out `<Resource>` items during `_CompileTemporaryAssembly` phase. Using `EmbeddedResource` is equivalent (esp. in for `Xlf` based string resource generation with `Arcade.Sdk`) and will not be adversely affected by `PresentationBuildTasks` transformations.

Microsoft.Dotnet.Wpf.sln

Lines changed: 71 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -239,21 +239,48 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OSVersionHelper", "src\Micr
239239
EndProject
240240
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PresentationNative", "src\Microsoft.DotNet.Wpf\redist\PresentationNative\PresentationNative.vcxproj", "{AF9084C3-BF37-4A56-A851-89F3BAE731B3}"
241241
EndProject
242-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F3F4DFE8-A29C-4BA1-964D-954AB6732744}"
243-
EndProject
244-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.DotNet.Wpf", "Microsoft.DotNet.Wpf", "{C9ECC1A1-917F-43D3-B340-2035B4938507}"
245-
EndProject
246-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{34B64A4A-7C83-4F92-8C47-80E9FA10D660}"
247-
EndProject
248242
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{A48B585E-6AB0-4F8D-8484-77F37CB44437}"
249243
EndProject
250-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Xaml.Tests", "src\Microsoft.DotNet.Wpf\tests\UnitTests\System.Xaml.Tests\System.Xaml.Tests.csproj", "{B2F2A89C-55C9-41B1-A645-0948609BD8BE}"
251-
EndProject
252244
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PresentationFramework.Fluent", "src\Microsoft.DotNet.Wpf\src\Themes\PresentationFramework.Fluent\PresentationFramework.Fluent.csproj", "{3F2C0E0E-BB13-46D9-8D9A-08256A49ECA9}"
253245
EndProject
254246
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PresentationFramework.Fluent-ref", "src\Microsoft.DotNet.Wpf\src\Themes\PresentationFramework.Fluent\ref\PresentationFramework.Fluent-ref.csproj", "{3C43C553-2C1F-4EB9-8BF8-371D4A42E0FD}"
255247
EndProject
256-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PresentationCore.Tests", "src\Microsoft.DotNet.Wpf\tests\UnitTests\PresentationCore.Tests\PresentationCore.Tests.csproj", "{A4377D3F-6BA1-4994-945C-88667993E4F3}"
248+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eng", "eng", "{92968783-2008-4A16-A823-6737224FEB9E}"
249+
ProjectSection(SolutionItems) = preProject
250+
.editorconfig = .editorconfig
251+
eng\WpfArcadeSdk\Sdk\Sdk.props = eng\WpfArcadeSdk\Sdk\Sdk.props
252+
eng\WpfArcadeSdk\Sdk\Sdk.targets = eng\WpfArcadeSdk\Sdk\Sdk.targets
253+
eng\WpfArcadeSdk\tools\SdkReferences.targets = eng\WpfArcadeSdk\tools\SdkReferences.targets
254+
eng\Versions.props = eng\Versions.props
255+
EndProjectSection
256+
EndProject
257+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documentation", "Documentation", "{B90B3D18-1B80-4FAF-A8DF-146C4F930AF9}"
258+
ProjectSection(SolutionItems) = preProject
259+
Documentation\acceptance_criteria.md = Documentation\acceptance_criteria.md
260+
Documentation\api-compat.md = Documentation\api-compat.md
261+
Documentation\C++-notes.md = Documentation\C++-notes.md
262+
Documentation\c++-private-tools.md = Documentation\c++-private-tools.md
263+
Documentation\codegen.md = Documentation\codegen.md
264+
Documentation\contributing.md = Documentation\contributing.md
265+
Documentation\cycle-breakers.md = Documentation\cycle-breakers.md
266+
Documentation\developer-guide.md = Documentation\developer-guide.md
267+
Documentation\gen-api.md = Documentation\gen-api.md
268+
Documentation\getting-started.md = Documentation\getting-started.md
269+
Documentation\issue-guide.md = Documentation\issue-guide.md
270+
Documentation\localization_untranslated_strings.md = Documentation\localization_untranslated_strings.md
271+
Documentation\LocalMarkupCompilation.md = Documentation\LocalMarkupCompilation.md
272+
Documentation\packaging.md = Documentation\packaging.md
273+
Documentation\projects-and-assemblies.md = Documentation\projects-and-assemblies.md
274+
Documentation\redistributables.md = Documentation\redistributables.md
275+
Documentation\report-on-adding-new-property.md = Documentation\report-on-adding-new-property.md
276+
Documentation\solution-and-project-configurations.md = Documentation\solution-and-project-configurations.md
277+
Documentation\testing-in-helix.md = Documentation\testing-in-helix.md
278+
Documentation\wpf.vsconfig = Documentation\wpf.vsconfig
279+
EndProjectSection
280+
EndProject
281+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PresentationCore.Tests", "src\Microsoft.DotNet.Wpf\tests\UnitTests\PresentationCore.Tests\PresentationCore.Tests.csproj", "{398CD1C6-A92E-4B63-97CD-4CABD96FA868}"
282+
EndProject
283+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Xaml.Tests", "src\Microsoft.DotNet.Wpf\tests\UnitTests\System.Xaml.Tests\System.Xaml.Tests.csproj", "{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}"
257284
EndProject
258285
Global
259286
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1926,22 +1953,6 @@ Global
19261953
{AF9084C3-BF37-4A56-A851-89F3BAE731B3}.Release|x86.ActiveCfg = Release|Win32
19271954
{AF9084C3-BF37-4A56-A851-89F3BAE731B3}.Release|x86.Build.0 = Release|Win32
19281955
{AF9084C3-BF37-4A56-A851-89F3BAE731B3}.Release|x86.Deploy.0 = Release|Win32
1929-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1930-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
1931-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Debug|ARM64.ActiveCfg = Debug|ARM64
1932-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Debug|ARM64.Build.0 = Debug|ARM64
1933-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Debug|x64.ActiveCfg = Debug|x64
1934-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Debug|x64.Build.0 = Debug|x64
1935-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Debug|x86.ActiveCfg = Debug|x86
1936-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Debug|x86.Build.0 = Debug|x86
1937-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
1938-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Release|Any CPU.Build.0 = Release|Any CPU
1939-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Release|ARM64.ActiveCfg = Release|ARM64
1940-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Release|ARM64.Build.0 = Release|ARM64
1941-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Release|x64.ActiveCfg = Release|x64
1942-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Release|x64.Build.0 = Release|x64
1943-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Release|x86.ActiveCfg = Release|x86
1944-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE}.Release|x86.Build.0 = Release|x86
19451956
{3F2C0E0E-BB13-46D9-8D9A-08256A49ECA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19461957
{3F2C0E0E-BB13-46D9-8D9A-08256A49ECA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
19471958
{3F2C0E0E-BB13-46D9-8D9A-08256A49ECA9}.Debug|ARM64.ActiveCfg = Debug|arm64
@@ -1974,22 +1985,38 @@ Global
19741985
{3C43C553-2C1F-4EB9-8BF8-371D4A42E0FD}.Release|x64.Build.0 = Release|x64
19751986
{3C43C553-2C1F-4EB9-8BF8-371D4A42E0FD}.Release|x86.ActiveCfg = Release|Any CPU
19761987
{3C43C553-2C1F-4EB9-8BF8-371D4A42E0FD}.Release|x86.Build.0 = Release|Any CPU
1977-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1978-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
1979-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Debug|ARM64.ActiveCfg = Debug|ARM64
1980-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Debug|ARM64.Build.0 = Debug|ARM64
1981-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Debug|x64.ActiveCfg = Debug|x64
1982-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Debug|x64.Build.0 = Debug|x64
1983-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Debug|x86.ActiveCfg = Debug|x86
1984-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Debug|x86.Build.0 = Debug|x86
1985-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
1986-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Release|Any CPU.Build.0 = Release|Any CPU
1987-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Release|ARM64.ActiveCfg = Release|ARM64
1988-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Release|ARM64.Build.0 = Release|ARM64
1989-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Release|x64.ActiveCfg = Release|x64
1990-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Release|x64.Build.0 = Release|x64
1991-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Release|x86.ActiveCfg = Release|x86
1992-
{A4377D3F-6BA1-4994-945C-88667993E4F3}.Release|x86.Build.0 = Release|x86
1988+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1989+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Debug|Any CPU.Build.0 = Debug|Any CPU
1990+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Debug|ARM64.ActiveCfg = Debug|ARM64
1991+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Debug|ARM64.Build.0 = Debug|ARM64
1992+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Debug|x64.ActiveCfg = Debug|x64
1993+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Debug|x64.Build.0 = Debug|x64
1994+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Debug|x86.ActiveCfg = Debug|x86
1995+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Debug|x86.Build.0 = Debug|x86
1996+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Release|Any CPU.ActiveCfg = Release|Any CPU
1997+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Release|Any CPU.Build.0 = Release|Any CPU
1998+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Release|ARM64.ActiveCfg = Release|ARM64
1999+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Release|ARM64.Build.0 = Release|ARM64
2000+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Release|x64.ActiveCfg = Release|x64
2001+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Release|x64.Build.0 = Release|x64
2002+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Release|x86.ActiveCfg = Release|x86
2003+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868}.Release|x86.Build.0 = Release|x86
2004+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2005+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
2006+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Debug|ARM64.ActiveCfg = Debug|ARM64
2007+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Debug|ARM64.Build.0 = Debug|ARM64
2008+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Debug|x64.ActiveCfg = Debug|x64
2009+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Debug|x64.Build.0 = Debug|x64
2010+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Debug|x86.ActiveCfg = Debug|x86
2011+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Debug|x86.Build.0 = Debug|x86
2012+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
2013+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Release|Any CPU.Build.0 = Release|Any CPU
2014+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Release|ARM64.ActiveCfg = Release|ARM64
2015+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Release|ARM64.Build.0 = Release|ARM64
2016+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Release|x64.ActiveCfg = Release|x64
2017+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Release|x64.Build.0 = Release|x64
2018+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Release|x86.ActiveCfg = Release|x86
2019+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0}.Release|x86.Build.0 = Release|x86
19932020
EndGlobalSection
19942021
GlobalSection(SolutionProperties) = preSolution
19952022
HideSolutionNode = FALSE
@@ -2106,13 +2133,11 @@ Global
21062133
{7EE0E965-7DA4-4A94-9441-801E8D2CC1CD} = {4557C5C6-10B1-475C-8279-5511955D1C29}
21072134
{3801B5AE-6871-4A72-B400-1F6ABCBF9045} = {7EE0E965-7DA4-4A94-9441-801E8D2CC1CD}
21082135
{AF9084C3-BF37-4A56-A851-89F3BAE731B3} = {DDED00A7-24FD-4AEF-B264-2150F0E59B4D}
2109-
{C9ECC1A1-917F-43D3-B340-2035B4938507} = {F3F4DFE8-A29C-4BA1-964D-954AB6732744}
2110-
{34B64A4A-7C83-4F92-8C47-80E9FA10D660} = {C9ECC1A1-917F-43D3-B340-2035B4938507}
2111-
{A48B585E-6AB0-4F8D-8484-77F37CB44437} = {34B64A4A-7C83-4F92-8C47-80E9FA10D660}
2112-
{B2F2A89C-55C9-41B1-A645-0948609BD8BE} = {A48B585E-6AB0-4F8D-8484-77F37CB44437}
2136+
{A48B585E-6AB0-4F8D-8484-77F37CB44437} = {B0EFDB12-C931-4E7F-A6C2-D4AC111D7EDF}
21132137
{3F2C0E0E-BB13-46D9-8D9A-08256A49ECA9} = {5ACFB055-649D-4A01-98C2-B0BFE7E543D6}
21142138
{3C43C553-2C1F-4EB9-8BF8-371D4A42E0FD} = {60F4058B-D35B-42D2-B276-D44B3AC579BD}
2115-
{A4377D3F-6BA1-4994-945C-88667993E4F3} = {A48B585E-6AB0-4F8D-8484-77F37CB44437}
2139+
{398CD1C6-A92E-4B63-97CD-4CABD96FA868} = {A48B585E-6AB0-4F8D-8484-77F37CB44437}
2140+
{93C6A5C8-4545-49DD-8D48-DDD6665ADFC0} = {A48B585E-6AB0-4F8D-8484-77F37CB44437}
21162141
EndGlobalSection
21172142
GlobalSection(ExtensibilityGlobals) = postSolution
21182143
SolutionGuid = {B4340004-DAC0-497D-B69D-CFA7CD93F567}

eng/WpfArcadeSdk/tools/Pbt.targets

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,6 @@
2626
-->
2727
<EmbedUntrackedSources Condition="'$(InternalMarkupCompilation)'=='true'">false</EmbedUntrackedSources>
2828
</PropertyGroup>
29-
<!--
30-
Internal PBT compilation requires that we use <NetCoreReference>
31-
This is so that the copy of ref\WindowsBase.dll inherited from Microsoft.NetCore.App
32-
does not make its way through to markup-compilation.
33-
34-
In addition to this, our codebase requires that all references to Microsoft.NetCore.App
35-
be explicitly enumerated through the use of <NetCoreReference> to avoid inadvertent additions
36-
to assembly references during code-changes.
37-
-->
38-
<ItemGroup Condition="'$(InternalMarkupCompilation)'=='true'">
39-
<NetCoreReference Include="mscorlib" />
40-
<NetCoreReference Include="System" />
41-
<NetCoreReference Include="System.ComponentModel.TypeConverter" />
42-
<NetCoreReference Include="System.Runtime" />
43-
</ItemGroup>
4429

4530
<PropertyGroup Condition="'$(InternalMarkupCompilation)'=='true' And Exists('$(LocalMicrosoftWinFXTargets)')">
4631
<PrepareResourceNamesDependsOn>

eng/WpfArcadeSdk/tools/SdkReferences.targets

Lines changed: 32 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,14 @@
44
Version="$(MicrosoftPrivateWinformsVersion)"
55
ExcludeAssets="All"
66
GeneratePathProperty="True"
7-
Condition="'$(MSBuildProjectExtension)'!='.vcxproj'
7+
Condition="'$(MSBuildProjectExtension)' != '.vcxproj'
88
And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'
99
And $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '3.0'))
10-
And '$(NoAutoMicrosoftPrivateWinformsReference)'!='true'"/>
11-
12-
<!--
13-
When @(NetCoreReference) is non-empty, exclude all assets (ExcludeAssets = All) and re-add them in
14-
ResolveMicrosoftNetCoreAppReferences target
15-
-->
16-
<PackageReference Update="Microsoft.NETCore.App"
17-
GeneratePathProperty="true"
18-
ExcludeAssets="All"
19-
Condition="'@(NetCoreReference)'!='' And '$(DoNotLimitMicrosoftNetCoreReferences)'!='true' And '$(MSBuildProjectExtension)'!='.vcxproj' And '$(DisableImplicitFrameworkReferences)' != 'true' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
10+
And '$(NoAutoMicrosoftPrivateWinformsReference)' != 'true'"/>
2011

2112
<PackageReference Update="Microsoft.NETCore.App"
2213
GeneratePathProperty="true"
23-
Condition="('@(NetCoreReference)'=='' Or '$(DoNotLimitMicrosoftNetCoreReferences)' == 'true') And '$(MSBuildProjectExtension)'!='.vcxproj' And '$(DisableImplicitFrameworkReferences)' != 'true' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
14+
Condition="'$(MSBuildProjectExtension)'!='.vcxproj' And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
2415
</ItemGroup>
2516

2617
<Target Name="GeneratePathPropertyforMicrosoftWindowsDesktopApp"
@@ -40,82 +31,6 @@
4031
</ResolveAssemblyReferencesDependsOn>
4132
</PropertyGroup>
4233

43-
44-
<Target
45-
Name="LimitNetCoreAppReferences"
46-
AfterTargets="ResolveTargetingPackAssets;ResolveTargetingPacks"
47-
Returns="@(Reference)"
48-
Condition="'@(NetCoreReference)' != '' And '@(Reference)' != ''">
49-
<!--
50-
Example
51-
<NetCoreReference Include="Microsoft.CSharp" />
52-
-->
53-
54-
<!--
55-
Save Microsoft.NETCore.App.Ref assemblies, and remove those from @(Reference)
56-
-->
57-
<ItemGroup>
58-
<_netCoreAppSdkReference Remove="@(_netCoreAppSdkReference)" />
59-
<_netCoreAppSdkReference Include="@(Reference)"
60-
Condition="'%(Reference.NuGetPackageId)'=='Microsoft.NETCore.App.Ref'">
61-
<OriginalPath>%(Reference.Identity)</OriginalPath>
62-
</_netCoreAppSdkReference>
63-
64-
<Reference Remove="@(_netCoreAppSdkReference)" />
65-
</ItemGroup>
66-
67-
<ItemGroup>
68-
<_netCoreAppReferences Remove="@(_netCoreAppReferences)" />
69-
</ItemGroup>
70-
<FilterItem1ByItem2 Item1="@(_netCoreAppSdkReference->'%(FileName)')"
71-
Item2="@(NetCoreReference)"
72-
Metadata2="Identity"
73-
PreserveItem1Metadata="true">
74-
<Output ItemName="_netCoreAppReferences" TaskParameter="Result" />
75-
</FilterItem1ByItem2>
76-
77-
<ItemGroup>
78-
<Reference Include="@(_netCoreAppReferences->'%(OriginalPath)')" />
79-
</ItemGroup>
80-
</Target>
81-
82-
<Target Name="LimitWindowsDesktopAppReferences"
83-
AfterTargets="ResolveTargetingPacks;ResolveTargetingPackAsssets"
84-
Returns="@(Reference)"
85-
Condition="'@(WindowsDesktopReference)'!='' and '@(Reference)' != ''">
86-
<!--
87-
Example
88-
<WindowsDesktopReference Include="PresentationCore" />
89-
-->
90-
91-
<!--
92-
Save Microsoft.WindowsDesktop.App.Ref assemblies, and remove those from @(Reference)
93-
-->
94-
<ItemGroup>
95-
<_windowsDesktopAppSdkReference Remove="@(_windowsDesktopAppSdkReference)" />
96-
<_windowsDesktopAppSdkReference Include="@(Reference)"
97-
Condition="'%(Reference.NuGetPackageId)'=='Microsoft.WindowsDesktop.App.Ref'">
98-
<OriginalPath>%(Reference.Identity)</OriginalPath>
99-
</_windowsDesktopAppSdkReference>
100-
101-
<Reference Remove="@(_windowsDesktopAppSdkReference)" />
102-
</ItemGroup>
103-
104-
<ItemGroup>
105-
<_windowsDesktopAppReferences Remove="@(_windowsDesktopAppReferences)" />
106-
</ItemGroup>
107-
<FilterItem1ByItem2 Item1="@(_windowsDesktopAppSdkReference->'%(FileName)')"
108-
Item2="@(WindowsDesktopReference)"
109-
Metadata2="Identity"
110-
PreserveItem1Metadata="true">
111-
<Output ItemName="_windowsDesktopAppReferences" TaskParameter="Result" />
112-
</FilterItem1ByItem2>
113-
114-
<ItemGroup>
115-
<Reference Include="@(_windowsDesktopAppReferences->'%(OriginalPath)')" />
116-
</ItemGroup>
117-
</Target>
118-
11934
<Target
12035
Name="ResolveMicrosoftDotNetWpfGitHubReferences"
12136
Returns="@(ReferencePath)"
@@ -210,4 +125,33 @@
210125
</Reference>
211126
</ItemGroup>
212127
</Target>
128+
129+
<ItemGroup>
130+
<!-- We always want to use the local WindowsBase, not the one coming from the .NET runtime. -->
131+
<DefaultReferenceExclusion Include="WindowsBase"/>
132+
</ItemGroup>
133+
134+
<!--
135+
Allows excluding specific .NET runtime libraries from being implicitly referenced.
136+
For example, to exclude WindowsBase from being implicitly referenced, add the following to your project file:
137+
138+
<ItemGroup>
139+
<DefaultReferenceExclusion Include="WindowsBase" />
140+
</ItemGroup>
141+
-->
142+
<Target Name="FilterImplicitAssemblyReferences"
143+
Condition="'@(DefaultReferenceExclusion)' != ''"
144+
DependsOnTargets="ResolveProjectReferences"
145+
AfterTargets="ResolveTargetingPackAssets">
146+
<ItemGroup>
147+
<_referenceExclusion Include="@(DefaultReferenceExclusion)">
148+
<AssemblyName>%(DefaultReferenceExclusion.Identity)</AssemblyName>
149+
<FrameworkReferenceName>Microsoft.NETCore.App</FrameworkReferenceName>
150+
<ExternallyResolved>true</ExternallyResolved>
151+
</_referenceExclusion>
152+
153+
<Reference Remove="@(_referenceExclusion)"
154+
MatchOnMetadata="AssemblyName;FrameworkReferenceName;ExternallyResolved"/>
155+
</ItemGroup>
156+
</Target>
213157
</Project>

0 commit comments

Comments
 (0)