From 70268e7c82edbe1933f74d1a2f2f71df9ff1a153 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Wed, 14 Aug 2019 15:59:44 +0200 Subject: [PATCH] [Blazor][Fixes dotnet/aspnetcore-tooling#12933] Remove the need for a custom property when resolving static web assets from referenced projects * Removes the need for a custom property when resolving static web assets from referenced projects * Rolls in several improvements suggested by the MSBuild folks to improve performance.\n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/5335245b080acf52c262fb7964d3411d49143f29 --- ...soft.NET.Sdk.Razor.StaticWebAssets.targets | 134 ++++++++++-------- 1 file changed, 77 insertions(+), 57 deletions(-) diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets index e6b23f2802..e90aac13f8 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets @@ -50,7 +50,7 @@ Copyright (c) .NET Foundation. All rights reserved. - ResolveStaticWebAssetsInputs; + ResolveCurrentProjectStaticWebAssetsInputs; $(GetCurrentProjectStaticWebAssetsDependsOn) @@ -59,11 +59,21 @@ Copyright (c) .NET Foundation. All rights reserved. $(AssignTargetPathsDependsOn) - - _ResolveStaticWebAssetsProjectReferences; + + ResolveCurrentProjectStaticWebAssetsInputs; $(ResolveStaticWebAssetsInputsDependsOn) + + ResolveReferencedProjectsStaticWebAssets; + $(ResolveStaticWebAssetsInputsDependsOn) + + + + ResolveReferences; + $(ResolveReferencedProjectsStaticWebAssetsDependsOn) + + _CreateStaticWebAssetsCustomPropsCacheFile; $(GenerateStaticWebAssetsPackTargetsDependsOn) @@ -209,27 +219,68 @@ Copyright (c) .NET Foundation. All rights reserved. * Assets from the referenced packages. These will be implicitly included when nuget restores the package and includes the package props file for the package. --> + + + + + DependsOnTargets="$(ResolveStaticWebAssetsInputsDependsOn)" /> - + - - _content/$(PackageId) - + + + <_StaticWebAssetsProjectReference Include="@(_MSBuildProjectReferenceExistent)" /> + + + + + + + + + + + + + + + + + _content/$(PackageId) + + + <_ThisProjectStaticWebAsset - Include="$(MSBuildProjectDirectory)\wwwroot\**" - Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" /> - - + Include="@(Content)" + Condition="$([System.String]::Copy('%(Identity)').StartsWith('wwwroot'))"> + + + $([System.String]::Copy('%(Identity)').Substring(8)) + + + + @@ -238,52 +289,19 @@ Copyright (c) .NET Foundation. All rights reserved. Full path to the content root for the item: * For packages it corresponds to %userprofile%/.nuget/packages/<>/<>/razorContent * For referenced projects it corresponds to <>/wwwroot - * For the current projects it corresponds to $(MSBuildThisProjectFileDirectory)wwwroot\ + * For the current projects it corresponds to $(MSBuildProjectDirectory)wwwroot\ --> - $(MSBuildProjectDirectory)\wwwroot\ + $([MSBuild]::NormalizeDirectory('$(MSBuildProjectDirectory)\wwwroot\')) $(StaticWebAssetBasePath) - %(RecursiveDir)%(FileName)%(Extension) + path to determine the final path for the file. + --> + %(RelativePath) - - - - - - - - - - - - - - - - - - <_StaticWebAssetsProjectReference Include="%(ReferencePath.MSBuildSourceProjectFile)" /> - - - + - + @@ -498,4 +518,4 @@ Copyright (c) .NET Foundation. All rights reserved. - \ No newline at end of file +