Skip to content

Include "ResolveTargetingPackAssets" in AfterTargets; Remove unused Targets #2230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 12 additions & 52 deletions eng/WpfArcadeSdk/tools/SdkReferences.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Project>
<ItemGroup>
<PackageReference Include="$(MicrosoftPrivateWinformsPackage)"
Version="$(MicrosoftPrivateWinformsVersion)"
Expand Down Expand Up @@ -30,45 +30,18 @@

<PropertyGroup>
<ResolveAssemblyReferencesDependsOn>
ResolveMicrosoftNetCoreAppReferences;
ResolveMicrosoftWindowsDesktopAppReferences;
ResolveMicrosoftDotNetWpfGitHubReferences;
ResolveWinFormsReferences;
$(ResolveAssemblyReferencesDependsOn)
</ResolveAssemblyReferencesDependsOn>
</PropertyGroup>

<Target
Name="ResolveMicrosoftNetCoreAppReferences"
Returns="@(Reference)"
Condition="'$(PkgMicrosoft_NETCore_App)'!='' And '@(NetCoreReference)'!='' and $(TargetFramework.StartsWith('netcoreapp3')) and '$(DoNotLimitMicrosoftNetCoreReferences)'!='true'">
<!--
In your project, Add a references to assemblies from Microsoft.NETCore.App like this
<ItemGroup>
<NetCoreReference Include="netstandard" />
<NetCoreReference Include="System.IO" />
</ItemGroup>

It will get translated into something like this:
<ItemGroup>
<Reference Include="C:\Users\username\.nuget\packages\microsoft.netcore.app\3.0.0-preview5-27609-17\ref\netcoreapp3.0\netstandard.dll" />
<Reference Include="C:\Users\username\.nuget\packages\microsoft.netcore.app\3.0.0-preview5-27609-17\ref\netcoreapp3.0\System.IO.dll" />
</ItemGroup>
-->
<ItemGroup>
<Reference Include="$(PkgMicrosoft_NETCore_App)\ref\$(TargetFramework)\%(NetCoreReference.Identity).dll"
Condition="Exists('$(PkgMicrosoft_NETCore_App)\ref\$(TargetFramework)\%(NetCoreReference.Identity).dll')" >
<NuGetPackageId>Microsoft.NetCore.App</NuGetPackageId>
</Reference>
</ItemGroup>
</Target>


<Target
Name="LimitNetCoreAppReferences"
AfterTargets="ResolveTargetingPacks"
AfterTargets="ResolveTargetingPackAssets;ResolveTargetingPacks"
Returns="@(Reference)"
Condition="'$(PkgMicrosoft_NETCore_App)'!='' And '@(NetCoreReference)' != '' And '@(Reference)' != ''">
Condition="'@(NetCoreReference)' != '' And '@(Reference)' != ''">
<!--
Example
<NetCoreReference Include="Microsoft.CSharp" />
Expand Down Expand Up @@ -102,28 +75,10 @@
</ItemGroup>
</Target>

<Target Name="ResolveMicrosoftWindowsDesktopAppReferences"
Returns="@(Reference)"
Condition="'$(PkgMicrosoft_WindowsDesktop_App)'!='' And '@(WindowsDesktopAppReference)'!='' and $(TargetFramework.StartsWith('netcoreapp3')) and '$(DoNotLimitWindowsDesktopAppReferences)'!='true'">
<!--
In your project, Add a references to assemblies from Microsoft.NETCore.App like this
<ItemGroup>
<WindowsDesktopAppeference Include="PresentationCore" />
<WindowsDesktopAppeference Include="System.Xaml" />
</ItemGroup>
-->
<ItemGroup>
<Reference Include="$(PkgMicrosoft_WindowsDesktop_App)\ref\$(TargetFramework)\%(NetCoreReference.Identity).dll"
Condition="Exists('$(PkgMicrosoft_WindowsDesktop_App)\ref\$(TargetFramework)\%(NetCoreReference.Identity).dll')">
<NuGetPackageId>Microsoft.WindowsDesktop.App</NuGetPackageId>
</Reference>
</ItemGroup>
</Target>

<Target Name="LimitWindowsDesktopAppReferences"
AfterTargets="ResolveTargetingPacks"
AfterTargets="ResolveTargetingPacks;ResolveTargetingPackAsssets"
Returns="@(Reference)"
Condition="'$(PkgMicrosoft_WindowsDesktop_App)'!='' And '@(WindowsDesktopReference)'!='' and '@(Reference)' != ''">
Condition="'@(WindowsDesktopReference)'!='' and '@(Reference)' != ''">
<!--
Example
<WindowsDesktopReference Include="PresentationCore" />
Expand Down Expand Up @@ -160,7 +115,10 @@
<Target
Name="ResolveMicrosoftDotNetWpfGitHubReferences"
Returns="@(ReferencePath)"
Condition="'@(MicrosoftDotNetWpfGitHubReference)'!='' and $(TargetFramework.StartsWith('netcoreapp3')) and '$(DoNotLimitMicrosoftDotNetWpfGitHubReferences)'!='true'">
Condition="'@(MicrosoftDotNetWpfGitHubReference)'!=''
And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'
And '$(TargetFrameworkVersion)' == 'v3.0'
and '$(DoNotLimitMicrosoftDotNetWpfGitHubReferences)'!='true'">
<!--
In your project, Add a references to WPF GitHub transport package like this:
<ItemGroup>
Expand Down Expand Up @@ -198,7 +156,9 @@
</ItemGroup>
-->
<Target Name="ResolveWinFormsReferences"
Condition="'@(MicrosoftPrivateWinFormsReference)'!='' And $(TargetFramework.StartsWith('netcoreapp3'))">
Condition="'@(MicrosoftPrivateWinFormsReference)'!=''
And '$(TargetFrameworkIdentifier)' == '.NETCoreApp'
And '$(TargetFrameworkVersion)' == 'v3.0'">
<ItemGroup>
<Reference Include="$(PkgMicrosoft_Private_Winforms)\ref\$(TargetFramework)\%(MicrosoftPrivateWinFormsReference.Identity).dll"
Condition="Exists('$(PkgMicrosoft_Private_Winforms)\ref\$(TargetFramework)\%(MicrosoftPrivateWinFormsReference.Identity).dll')">
Expand Down