Skip to content

Commit

Permalink
[One .NET] exclude Xamarin.Android.PCLSupport.targets (dotnet#5430)
Browse files Browse the repository at this point in the history
We are currently importing/using `Xamarin.Android.PCLSupport.targets`,
which does not appear to be needed at all in .NET 6.

Even if I add a PCL such as PCLStorage:

	<PackageReference Include="PCLStorage" Version="1.0.2" />

The `ImplicitlyExpandDesignTimeFacades` target doesn't do any actual work:

	Task "GetDependsOnNETStandard" skipped, due to false condition; ('$(_HasReferenceToSystemRuntime)' != 'true' and '$(_IsXBuild)' != 'true' and '$(DependsOnNETStandard)' == '' and '@(_XACandidateNETStandardReferences->Count())' != '0') was evaluated as ('true' != 'true' and 'true' != 'true' and '' == '' and '156' != '0').
	Task "Message" skipped, due to false condition; ('%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandDesignTimeFacades') was evaluated as ('{RawFileName}' == 'ImplicitlyExpandDesignTimeFacades').

The dotnet/sdk, seems to already know how to bring in
`netstandard.dll`, and we don't need to do anything here.

Let's exclude `Xamarin.Android.PCLSupport.targets` and
`Xamarin.Android.PCLSupport.props` from the .NET 6 packages and stop
importing them.

This should save a small amount of time on every .NET 6 build:

	4 ms  ImplicitlyExpandDesignTimeFacades          3 calls

This target was being called N+1 times per `$(RuntimeIdentifier)` and
is completely removed now. This was a ~4ms savings on a "Hello World"
.NET 6 application on macOS.
  • Loading branch information
jonathanpeppers authored Dec 16, 2020
1 parent 087c7f4 commit cbbd853
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build-tools/installers/create-installers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.EmbeddedResource.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.FSharp.targets" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.Legacy.targets" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.PCLSupport.props" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.PCLSupport.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.PCLSupport.props" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.PCLSupport.targets" ExcludeFromAndroidNETSdk="true" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.SkipCases.projitems" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.Tooling.targets" />
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.Tools.Aidl.dll" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2615,7 +2615,8 @@ because xbuild doesn't support framework reference assemblies.

<Import Project="$(MSBuildThisFileDirectory)Xamarin.Android.Application.targets"
Condition=" '$(AndroidApplication)' == 'True' "/>
<Import Project="$(MSBuildThisFileDirectory)Xamarin.Android.PCLSupport.targets" />
<Import Project="$(MSBuildThisFileDirectory)Xamarin.Android.PCLSupport.targets"
Condition=" '$(UsingAndroidNETSdk)' != 'true' " />
<Import Project="$(MSBuildThisFileDirectory)Xamarin.Android.Designer.targets" />

<Import Project="$(MSBuildThisFileDirectory)Xamarin.Installer.Common.targets"
Expand Down

0 comments on commit cbbd853

Please sign in to comment.