From 45f711731e8aa8f4afaabf656d163969bc9bc14a Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 14:19:14 +0100 Subject: [PATCH 01/20] Add asset group tagging, filtering, path rewriting, and JSON manifest packaging Introduce StaticWebAssetGroupDefinition (producer-side) and StaticWebAssetGroup (consumer-side) item types for declarative asset variant selection. Core changes: - DefineStaticWebAssets: group definition processing with IncludePattern, RelativePathPattern, RelativePathPrefix, ContentRootSuffix - FilterStaticWebAssetGroups: two-pass filtering (SkipDeferred for restore/P2P, full filtering for endpoints manifest) - StaticWebAssetEndpointGroup: safe endpoint partitioning by AssetFile - StaticWebAssetPathPattern: file-only '~' modifier for tokens - StaticWebAssetTokenResolver: resolve group values from AssetGroups metadata - ComputeReferenceStaticWebAssetItems: allow distinct groups at same path - StaticWebAsset: AssetGroups property, FilterByGroup, SortByRelatedAssetInPlace JSON manifest packaging: - GeneratePackageAssetsManifestFile: write {PackageId}.PackageAssets.json - GeneratePackageAssetsTargetsFile: write lightweight .targets with manifest ref - ReadPackageAssetsManifest: read JSON, apply group filtering, materialize framework assets Target changes across .targets, .Pack.targets, .Publish.targets, .References.targets --- ...oft.NET.Sdk.BlazorWebAssembly.Tasks.csproj | 2 + ...osoft.NET.Sdk.StaticWebAssets.Pack.targets | 107 +++++- ...ft.NET.Sdk.StaticWebAssets.Publish.targets | 20 +- ...NET.Sdk.StaticWebAssets.References.targets | 1 + .../Microsoft.NET.Sdk.StaticWebAssets.targets | 79 +++- .../Compression/ResolveCompressedAssets.cs | 2 +- .../ComputeReferenceStaticWebAssetItems.cs | 28 +- ...ComputeStaticWebAssetsForCurrentProject.cs | 18 + .../ComputeStaticWebAssetsTargetPaths.cs | 5 +- .../StaticWebAssetsJsonSerializerContext.cs | 1 + .../Tasks/Data/StaticWebAsset.cs | 338 +++++++++++++++++- .../Tasks/Data/StaticWebAssetEndpointGroup.cs | 79 ++++ .../Tasks/Data/StaticWebAssetGroup.cs | 79 ++++ .../Data/StaticWebAssetPackageManifest.cs | 22 ++ .../Tasks/Data/StaticWebAssetPathPattern.cs | 57 ++- .../Tasks/Data/StaticWebAssetPathSegment.cs | 4 +- .../Tasks/Data/StaticWebAssetTokenResolver.cs | 5 + .../Tasks/DefineStaticWebAssets.cs | 263 +++++++++++++- .../Tasks/FilterStaticWebAssetGroups.cs | 110 ++++++ .../GeneratePackageAssetsManifestFile.cs | 176 +++++++++ .../Tasks/GeneratePackageAssetsTargetsFile.cs | 66 ++++ .../Tasks/GenerateStaticWebAssetsManifest.cs | 3 +- .../Tasks/ReadPackageAssetsManifest.cs | 218 +++++++++++ .../UpdateExternallyDefinedStaticWebAssets.cs | 17 +- 24 files changed, 1670 insertions(+), 30 deletions(-) create mode 100644 src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetEndpointGroup.cs create mode 100644 src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetGroup.cs create mode 100644 src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPackageManifest.cs create mode 100644 src/StaticWebAssetsSdk/Tasks/FilterStaticWebAssetGroups.cs create mode 100644 src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs create mode 100644 src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsTargetsFile.cs create mode 100644 src/StaticWebAssetsSdk/Tasks/ReadPackageAssetsManifest.cs diff --git a/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj b/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj index d20877934082..38990a828d78 100644 --- a/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj +++ b/src/BlazorWasmSdk/Tasks/Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.csproj @@ -62,11 +62,13 @@ + + diff --git a/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Pack.targets b/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Pack.targets index 9d8133e69ece..fbae9c88848b 100644 --- a/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Pack.targets +++ b/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Pack.targets @@ -37,6 +37,17 @@ Copyright (c) .NET Foundation. All rights reserved. AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" Condition="'$(StaticWebAssetsSdkBuildTasksAssembly)' != ''" /> + + + + + - + + build\Microsoft.AspNetCore.StaticWebAssets.props @@ -109,10 +123,56 @@ Copyright (c) .NET Foundation. All rights reserved. + + + + + build\$(PackageId).PackageAssets.json + + + + build\Microsoft.AspNetCore.StaticWebAssets.targets + + + + build\$(PackageId).targets + + + + buildMultiTargeting\$(PackageId).targets + + + + buildTransitive\$(PackageId).targets + + + + + + + + + + + + + <_PackStaticWebAssetCandidates Include="@(StaticWebAsset)" Exclude="@(_StaticWebAssetExcludedFromPack)" /> + + + <_StaticWebAssetGroupsConventionFile Include="$(MSBuildProjectDirectory)\StaticWebAssets.Groups.targets" /> + + build\StaticWebAssets.Groups.targets + + + @@ -166,6 +227,7 @@ Copyright (c) .NET Foundation. All rights reserved. that describes the static web asset endpoints associated with the assets in the package. --> @@ -174,14 +236,16 @@ Copyright (c) .NET Foundation. All rights reserved. build\Microsoft.AspNetCore.StaticWebAssets.props --> + AdditionalImports="$(_StaticWebAssetEndpointsPropsFileImportPath);@(_StaticWebAssetGroupsConventionFile->'StaticWebAssets.Groups.props')" /> @@ -189,9 +253,48 @@ Copyright (c) .NET Foundation. All rights reserved. buildMultiTargeting\$(PackageId) --> + + + + + + + + + + + + + + + + + diff --git a/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Publish.targets b/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Publish.targets index 0b392f857100..f61a6a5d11c6 100644 --- a/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Publish.targets +++ b/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.Publish.targets @@ -34,6 +34,24 @@ Copyright (c) .NET Foundation. All rights reserved. ManifestPath="$(StaticWebAssetPublishManifestPath)"> + + + + + + + + <_FinalPublishStaticWebAsset Remove="@(_FinalPublishStaticWebAsset)" /> + <_FinalPublishStaticWebAsset Include="@(_FilteredPublishAssets)" /> + + + + - + diff --git a/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.References.targets b/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.References.targets index 2ce47328997a..aa6a42be84ef 100644 --- a/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.References.targets +++ b/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.References.targets @@ -132,6 +132,7 @@ Copyright (c) .NET Foundation. All rights reserved. Assets="@(_ResolvedReferencedProjectBuildStaticWebAssetCandidates)" Endpoints="@(_ReferencedProjectBuildStaticWebAssetEndpointsUpdateCandidates)" FingerprintInferenceExpressions="@(StaticWebAssetFingerprintInferenceExpression)" + StaticWebAssetGroups="@(StaticWebAssetGroup)" > diff --git a/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.targets b/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.targets index 5dba7e8a9032..530033f25985 100644 --- a/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.targets +++ b/src/StaticWebAssetsSdk/Targets/Microsoft.NET.Sdk.StaticWebAssets.targets @@ -57,6 +57,11 @@ Copyright (c) .NET Foundation. All rights reserved. AssemblyFile="$(StaticWebAssetsSdkBuildTasksAssembly)" Condition="'$(StaticWebAssetsSdkBuildTasksAssembly)' != ''" /> + + + + + <_GeneratedPackageAssetsManifestFile>$(_StaticWebAssetsIntermediateOutputPath)$(PackageId).PackageAssets.json + <_GeneratedStaticWebAssetsTargetsFile>$(_StaticWebAssetsIntermediateOutputPath)msbuild.$(PackageId).Microsoft.AspNetCore.StaticWebAssets.targets + <_GeneratedBuildTargetsFile>$(_StaticWebAssetsIntermediateOutputPath)msbuild.build.$(PackageId).targets + <_GeneratedBuildMultitargetingTargetsFile>$(_StaticWebAssetsIntermediateOutputPath)msbuild.buildMultiTargeting.$(PackageId).targets + <_GeneratedBuildTransitiveTargetsFile>$(_StaticWebAssetsIntermediateOutputPath)msbuild.buildTransitive.$(PackageId).targets + + + <_StaticWebAssetsTargetsFileImportPath>Microsoft.AspNetCore.StaticWebAssets.targets + <_StaticWebAssetsGeneratedBuildTargetsFileImportPath>..\build\$(PackageId).targets + <_StaticWebAssetsGeneratedBuildMultiTargetingTargetsFileImportPath>..\buildMultiTargeting\$(PackageId).targets + + + <_UseJsonManifestPackaging Condition="'$(_UseJsonManifestPackaging)' == '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '11.0'))">true + <_UseJsonManifestPackaging Condition="'$(_UseJsonManifestPackaging)' == ''">false + $(_StaticWebAssetsManifestBase)staticwebassets.upToDateCheck.txt $(_StaticWebAssetsManifestBase)staticwebassets.references.upToDateCheck.txt @@ -650,11 +684,23 @@ Copyright (c) .NET Foundation. All rights reserved. ManifestCacheFilePath="$(StaticWebAssetsBuildManifestCacheFilePath)"> + + + + + + @@ -690,6 +736,13 @@ Copyright (c) .NET Foundation. All rights reserved. + + + + @@ -697,7 +750,7 @@ Copyright (c) .NET Foundation. All rights reserved. + DependsOnTargets="ResolveStaticWebAssetsConfiguration;UpdateExistingPackageStaticWebAssets;AssignLinkMetadata"> <_ResolveProjectStaticWebAssetsCachePath Condition="'$(StaticWebAssetsCacheDefineStaticWebAssetsEnabled)' == 'true'">$(_StaticWebAssetsManifestBase)rpswa.dswa.cache.json @@ -713,7 +766,8 @@ Copyright (c) .NET Foundation. All rights reserved. ContentRoot="$(MSBuildProjectDirectory)\wwwroot\" BasePath="$(StaticWebAssetBasePath)" AssetMergeSource="$(StaticWebAssetMergeTarget)" - CacheManifestPath="$(_ResolveProjectStaticWebAssetsCachePath)"> + CacheManifestPath="$(_ResolveProjectStaticWebAssetsCachePath)" + StaticWebAssetGroupDefinitions="@(StaticWebAssetGroupDefinition)"> @@ -741,6 +795,21 @@ Copyright (c) .NET Foundation. All rights reserved. + + + + + + + (existingAssets.Count); + var groupSet = new HashSet(StringComparer.Ordinal); foreach (var kvp in existingAssets) { var targetPath = kvp.Key; var (selected, all) = kvp.Value; if (all != null) { + // If all assets have distinct, non-empty AssetGroups, they can coexist + if (StaticWebAsset.AllAssetsHaveDistinctGroups(all, groupSet)) + { + foreach (var groupedAsset in all) + { + if (ShouldIncludeAssetAsReference(groupedAsset, out var groupReason)) + { + if (UpdateSourceType && !StaticWebAsset.SourceTypes.IsFramework(groupedAsset.SourceType)) + { + groupedAsset.SourceType = StaticWebAsset.SourceTypes.Project; + } + if (MakeReferencedAssetOriginalItemSpecAbsolute) + { + groupedAsset.OriginalItemSpec = Path.GetFullPath(groupedAsset.OriginalItemSpec); + } + resultAssets.Add(groupedAsset); + } + Log.LogMessage(MessageImportance.Low, groupReason); + } + continue; + } + Log.LogError("More than one compatible asset found for target path '{0}' -> {1}.", targetPath, Environment.NewLine + string.Join(Environment.NewLine, all.Select(a => $"({a.Identity},{a.AssetKind})"))); @@ -55,7 +78,10 @@ public override bool Execute() if (ShouldIncludeAssetAsReference(selected, out var reason)) { - selected.SourceType = UpdateSourceType ? StaticWebAsset.SourceTypes.Project : selected.SourceType; + if (UpdateSourceType && !StaticWebAsset.SourceTypes.IsFramework(selected.SourceType)) + { + selected.SourceType = StaticWebAsset.SourceTypes.Project; + } if (MakeReferencedAssetOriginalItemSpecAbsolute) { selected.OriginalItemSpec = Path.GetFullPath(selected.OriginalItemSpec); diff --git a/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsForCurrentProject.cs b/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsForCurrentProject.cs index 3c4d49582d2e..a5211a0bcb89 100644 --- a/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsForCurrentProject.cs +++ b/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsForCurrentProject.cs @@ -31,12 +31,30 @@ public override bool Execute() var currentProjectAssets = StaticWebAsset.AssetsByTargetPath(Assets, Source, AssetKind); var resultAssets = new List(currentProjectAssets.Count); + var groupSet = new HashSet(StringComparer.Ordinal); foreach (var kvp in currentProjectAssets) { var targetPath = kvp.Key; var (selected, all) = kvp.Value; if (all != null) { + // If all assets have distinct, non-empty AssetGroups, they can coexist + if (StaticWebAsset.AllAssetsHaveDistinctGroups(all, groupSet)) + { + foreach (var groupedAsset in all) + { + if (!groupedAsset.IsForReferencedProjectsOnly()) + { + resultAssets.Add(groupedAsset); + } + else + { + Log.LogMessage(MessageImportance.Low, "Skipping asset '{0}' because it is for referenced projects only.", groupedAsset.Identity); + } + } + continue; + } + Log.LogError("More than one compatible asset found for target path '{0}' -> {1}.", targetPath, Environment.NewLine + string.Join(Environment.NewLine, all.Select(a => $"({a.Identity},{a.AssetKind})"))); diff --git a/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsTargetPaths.cs b/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsTargetPaths.cs index cf3203106fc2..80336ba3760b 100644 --- a/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsTargetPaths.cs +++ b/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsTargetPaths.cs @@ -27,14 +27,16 @@ public override bool Execute() { Log.LogMessage(MessageImportance.Low, "Using path prefix '{0}'", PathPrefix); AssetsWithTargetPath = new ITaskItem[Assets.Length]; + var separator = UseAlternatePathDirectorySeparator ? Path.AltDirectorySeparatorChar : Path.DirectorySeparatorChar; for (var i = 0; i < Assets.Length; i++) { var staticWebAsset = StaticWebAsset.FromTaskItem(Assets[i]); var result = staticWebAsset.ToTaskItem(); + var targetPath = staticWebAsset.ComputeTargetPath( PathPrefix, - UseAlternatePathDirectorySeparator ? Path.AltDirectorySeparatorChar : Path.DirectorySeparatorChar, StaticWebAssetTokenResolver.Instance); + separator, StaticWebAssetTokenResolver.Instance); if (AdjustPathsForPack && string.IsNullOrEmpty(Path.GetExtension(targetPath))) { @@ -53,4 +55,5 @@ public override bool Execute() return !Log.HasLoggedErrors; } + } diff --git a/src/StaticWebAssetsSdk/Tasks/Data/Serialization/StaticWebAssetsJsonSerializerContext.cs b/src/StaticWebAssetsSdk/Tasks/Data/Serialization/StaticWebAssetsJsonSerializerContext.cs index 77b47ab5c180..c57d29a60af0 100644 --- a/src/StaticWebAssetsSdk/Tasks/Data/Serialization/StaticWebAssetsJsonSerializerContext.cs +++ b/src/StaticWebAssetsSdk/Tasks/Data/Serialization/StaticWebAssetsJsonSerializerContext.cs @@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; [JsonSerializable(typeof(StaticWebAssetsManifest))] [JsonSerializable(typeof(GenerateStaticWebAssetsDevelopmentManifest.StaticWebAssetsDevelopmentManifest))] [JsonSerializable(typeof(StaticWebAssetEndpointsManifest))] +[JsonSerializable(typeof(StaticWebAssetPackageManifest))] [JsonSourceGenerationOptions( GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization, WriteIndented = false)] diff --git a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs index 935b34bdf86a..18fbae00c2d2 100644 --- a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs +++ b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs @@ -37,6 +37,8 @@ public sealed class StaticWebAsset : IEquatable, IComparable _assetGroupValues; private string _fingerprint; private string _integrity; private string _copyToOutputDirectory; @@ -68,6 +70,7 @@ public StaticWebAsset(StaticWebAsset asset) _relatedAsset = asset.RelatedAsset; _assetTraitName = asset.AssetTraitName; _assetTraitValue = asset.AssetTraitValue; + _assetGroups = asset.AssetGroups; _copyToOutputDirectory = asset.CopyToOutputDirectory; _copyToPublishDirectory = asset.CopyToPublishDirectory; _originalItemSpec = asset.OriginalItemSpec; @@ -227,6 +230,265 @@ public string AssetTraitValue } } + public string AssetGroups + { + get => _assetGroups ??= GetOriginalItemMetadata(nameof(AssetGroups)); + set + { + _modified = true; + _assetGroups = value; + _assetGroupValues = null; + } + } + + internal IReadOnlyDictionary GetAssetGroupValues() + { + _assetGroupValues ??= ParseAssetGroupValues(AssetGroups); + return _assetGroupValues; + } + + // Returns true if the asset's group requirements are all satisfied by the declared groups. + // When skipDeferred is true, groups marked Deferred are treated as provisionally satisfied. + // When sourceId is non-null, assets whose SourceId does not match pass through unconditionally. + internal bool MatchesGroups(Dictionary<(string SourceId, string Name), StaticWebAssetGroup> groups, bool skipDeferred = false, string sourceId = null) + { + if (!string.IsNullOrEmpty(sourceId) && !string.Equals(SourceId, sourceId, StringComparison.Ordinal)) + { + return true; + } + + var requirements = GetAssetGroupValues(); + if (requirements.Count == 0) + { + return true; + } + + foreach (var requirement in requirements) + { + if (!groups.TryGetValue((SourceId, requirement.Key), out var group)) + { + return false; + } + + if (skipDeferred && group.Deferred) + { + continue; + } + + if (!string.Equals(group.Value, requirement.Value, StringComparison.Ordinal)) + { + return false; + } + } + + return true; + } + + // Sorts assets by RelatedAsset, then filters by group with cascading exclusion. + // Assets whose parent was excluded are also excluded. + // When sourceId is non-null, only assets with matching SourceId are evaluated; + // others pass through unconditionally. + internal static (List included, HashSet excluded) FilterByGroup( + StaticWebAsset[] assets, + Dictionary<(string SourceId, string Name), StaticWebAssetGroup> groups, + bool skipDeferred, + string sourceId = null) + { + SortByRelatedAssetInPlace(assets); + var included = new List(assets.Length); + var excluded = new HashSet(OSPath.PathComparer); + + foreach (var asset in assets) + { + if (!string.IsNullOrEmpty(asset.RelatedAsset) && excluded.Contains(asset.RelatedAsset)) + { + excluded.Add(asset.Identity); + continue; + } + + if (asset.MatchesGroups(groups, skipDeferred, sourceId)) + { + included.Add(asset); + } + else + { + excluded.Add(asset.Identity); + } + } + + return (included, excluded); + } + + // In-place topological sort by RelatedAsset using a two-pointer approach. + // Mutates the input span so that parents appear before dependents. + // O(n) amortized time — i and tail each visit every index at most once. + // O(n) auxiliary space for the seen/deferred maps; no result array allocated. + internal static void SortByRelatedAssetInPlace(Span assets) + { + if (assets.Length <= 1) + { + return; + } + + var seen = new HashSet(assets.Length, OSPath.PathComparer); + var deferred = new Dictionary(OSPath.PathComparer); + var tail = assets.Length - 1; + + for (var i = 0; i < assets.Length; i++) + { + while (!IsPlaceable(assets[i], seen)) + { + // Strategy 1: the parent was displaced earlier and we know where it is. + var parentIndex = FindInDeferred(assets[i], deferred); + if (parentIndex >= 0) + { + deferred.Remove(assets[i].RelatedAsset); + deferred[assets[i].Identity] = parentIndex; + (assets[i], assets[parentIndex]) = (assets[parentIndex], assets[i]); + continue; + } + + // Strategy 2: scan backward from tail for any placeable element. + var placeableIndex = ScanTailForPlaceable(assets, seen, deferred, i, ref tail); + if (placeableIndex < 0) + { + break; // tail exhausted — orphan, place as-is + } + + deferred[assets[i].Identity] = placeableIndex; + (assets[i], assets[placeableIndex]) = (assets[placeableIndex], assets[i]); + } + + seen.Add(assets[i].Identity); + } + } + + private static bool IsPlaceable(StaticWebAsset asset, HashSet seen) => + string.IsNullOrEmpty(asset.RelatedAsset) || seen.Contains(asset.RelatedAsset); + + private static int FindInDeferred(StaticWebAsset asset, Dictionary deferred) => + deferred.TryGetValue(asset.RelatedAsset, out var index) ? index : -1; + + // Walks tail downward, deferring every non-placeable element it passes, + // and returns the index of the first placeable element found (or -1). + private static int ScanTailForPlaceable( + Span assets, HashSet seen, + Dictionary deferred, int floor, ref int tail) + { + while (tail > floor) + { + if (IsPlaceable(assets[tail], seen)) + { + return tail--; + } + + deferred[assets[tail].Identity] = tail; + tail--; + } + + return -1; + } + + // List overload: delegates to Span on modern .NET, uses IList indexer on net472. + internal static void SortByRelatedAssetInPlace(List assets) + { +#if NET6_0_OR_GREATER + SortByRelatedAssetInPlace(System.Runtime.InteropServices.CollectionsMarshal.AsSpan(assets)); +#else + if (assets.Count <= 1) + { + return; + } + + var seen = new HashSet(assets.Count, OSPath.PathComparer); + var deferred = new Dictionary(OSPath.PathComparer); + var tail = assets.Count - 1; + + for (var i = 0; i < assets.Count; i++) + { + while (!IsPlaceable(assets[i], seen)) + { + var parentIndex = FindInDeferred(assets[i], deferred); + if (parentIndex >= 0) + { + deferred.Remove(assets[i].RelatedAsset); + deferred[assets[i].Identity] = parentIndex; + (assets[i], assets[parentIndex]) = (assets[parentIndex], assets[i]); + continue; + } + + var placeableIndex = ScanTailForPlaceable(assets, seen, deferred, i, ref tail); + if (placeableIndex < 0) + { + break; + } + + deferred[assets[i].Identity] = placeableIndex; + (assets[i], assets[placeableIndex]) = (assets[placeableIndex], assets[i]); + } + + seen.Add(assets[i].Identity); + } +#endif + } + +#if !NET6_0_OR_GREATER + private static int ScanTailForPlaceable( + List assets, HashSet seen, + Dictionary deferred, int floor, ref int tail) + { + while (tail > floor) + { + if (IsPlaceable(assets[tail], seen)) + { + return tail--; + } + + deferred[assets[tail].Identity] = tail; + tail--; + } + + return -1; + } +#endif + + internal bool TryGetAssetGroupValue(string key, out string value) + { + if (string.IsNullOrEmpty(key)) + { + value = null; + return false; + } + + return GetAssetGroupValues().TryGetValue(key, out value); + } + + private static Dictionary ParseAssetGroupValues(string assetGroups) + { + var result = new Dictionary(StringComparer.Ordinal); + if (string.IsNullOrEmpty(assetGroups)) + { + return result; + } + + var requirements = assetGroups.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); + foreach (var requirement in requirements) + { + var eqIdx = requirement.IndexOf('='); + if (eqIdx <= 0 || eqIdx == requirement.Length - 1) + { + throw new InvalidOperationException( + $"Malformed AssetGroups segment '{requirement}' in value '{assetGroups}'. Expected 'Name=Value' format."); + } + + var reqName = requirement.Substring(0, eqIdx); + var reqValue = requirement.Substring(eqIdx + 1); + result[reqName] = reqValue; + } + + return result; + } + public string Fingerprint { get => _fingerprint ??= GetOriginalItemMetadata(nameof(Fingerprint)); @@ -385,7 +647,7 @@ internal static IEnumerable ChooseNearestAssetKind(IEnumerable Others) group, out string reason) + internal static bool ValidateAssetGroup(string path, (StaticWebAsset First, StaticWebAsset Second, IReadOnlyList Others) group, out string reason, HashSet reusableGroupSet) { var prototypeItem = group.First; StaticWebAsset build = null; @@ -399,6 +661,15 @@ internal static bool ValidateAssetGroup(string path, (StaticWebAsset First, Stat return true; } + // If assets at the same path have different non-empty AssetGroups values, they are variant + // alternatives that will be disambiguated by group filtering on the consumer side. + // Allow them to coexist in the manifest. + if (AllAssetsHaveDistinctGroups(group, reusableGroupSet)) + { + reason = null; + return true; + } + // Check First against Second for source ID conflict if (!prototypeItem.HasSourceId(group.Second.SourceId)) { @@ -474,6 +745,59 @@ internal static bool ValidateAssetGroup(string path, (StaticWebAsset First, Stat return true; } + private static bool AllAssetsHaveDistinctGroups( + (StaticWebAsset First, StaticWebAsset Second, IReadOnlyList Others) group, + HashSet reusableGroupSet) + { + reusableGroupSet.Clear(); + + if (!TryAddAssetGroup(reusableGroupSet, group.First)) + { + return false; + } + + if (group.Second != null && !TryAddAssetGroup(reusableGroupSet, group.Second)) + { + return false; + } + + if (group.Others != null) + { + foreach (var item in group.Others) + { + if (!TryAddAssetGroup(reusableGroupSet, item)) + { + return false; + } + } + } + + return reusableGroupSet.Count > 0; + } + + internal static bool AllAssetsHaveDistinctGroups(IEnumerable assets, HashSet reusableGroupSet) + { + reusableGroupSet.Clear(); + + foreach (var asset in assets) + { + if (!TryAddAssetGroup(reusableGroupSet, asset)) + { + return false; + } + } + return reusableGroupSet.Count > 0; + } + + private static bool TryAddAssetGroup(HashSet groups, StaticWebAsset asset) + { + if (string.IsNullOrEmpty(asset.AssetGroups)) + { + return false; + } + return groups.Add(asset.AssetGroups); + } + private bool HasKind(string assetKind) => AssetKinds.IsKind(AssetKind, assetKind); @@ -1257,6 +1581,11 @@ internal static StaticWebAsset[] FromTaskItemGroup(ITaskItem[] candidateAssets, return result; } + internal static ITaskItem[] ToTaskItems(IEnumerable assets) + { + return assets.Select(a => a.ToTaskItem()).ToArray(); + } + internal static Dictionary)> AssetsByTargetPath(ITaskItem[] assets, string source, string assetKind) { // We return either the selected asset or a list with all the candidates that were found to be ambiguous @@ -1346,6 +1675,7 @@ private static bool HasOppositeKind(ITaskItem candidate, string assetKind) nameof(RelatedAsset), nameof(AssetTraitName), nameof(AssetTraitValue), + nameof(AssetGroups), nameof(Fingerprint), nameof(Integrity), nameof(CopyToOutputDirectory), @@ -1399,6 +1729,7 @@ string ITaskItem2.GetMetadataValueEscaped(string metadataName) nameof(RelatedAsset) => RelatedAsset ?? "", nameof(AssetTraitName) => AssetTraitName ?? "", nameof(AssetTraitValue) => AssetTraitValue ?? "", + nameof(AssetGroups) => AssetGroups ?? "", nameof(Fingerprint) => Fingerprint ?? "", nameof(Integrity) => Integrity ?? "", nameof(CopyToOutputDirectory) => CopyToOutputDirectory ?? "", @@ -1460,6 +1791,9 @@ void ITaskItem2.SetMetadataValueLiteral(string metadataName, string metadataValu case nameof(AssetTraitValue): AssetTraitValue = metadataValue; break; + case nameof(AssetGroups): + AssetGroups = metadataValue; + break; case nameof(Fingerprint): Fingerprint = metadataValue; break; @@ -1508,6 +1842,7 @@ IDictionary ITaskItem2.CloneCustomMetadataEscaped() { nameof(RelatedAsset), RelatedAsset ?? "" }, { nameof(AssetTraitName), AssetTraitName ?? "" }, { nameof(AssetTraitValue), AssetTraitValue ?? "" }, + { nameof(AssetGroups), AssetGroups ?? "" }, { nameof(Fingerprint), Fingerprint ?? "" }, { nameof(Integrity), Integrity ?? "" }, { nameof(CopyToOutputDirectory), CopyToOutputDirectory ?? "" }, @@ -1547,6 +1882,7 @@ void ITaskItem.CopyMetadataTo(ITaskItem destinationItem) destinationItem.SetMetadata(nameof(RelatedAsset), RelatedAsset ?? ""); destinationItem.SetMetadata(nameof(AssetTraitName), AssetTraitName ?? ""); destinationItem.SetMetadata(nameof(AssetTraitValue), AssetTraitValue ?? ""); + destinationItem.SetMetadata(nameof(AssetGroups), AssetGroups ?? ""); destinationItem.SetMetadata(nameof(Fingerprint), Fingerprint ?? ""); destinationItem.SetMetadata(nameof(Integrity), Integrity ?? ""); destinationItem.SetMetadata(nameof(CopyToOutputDirectory), CopyToOutputDirectory ?? ""); diff --git a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetEndpointGroup.cs b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetEndpointGroup.cs new file mode 100644 index 000000000000..ac96371bd42a --- /dev/null +++ b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetEndpointGroup.cs @@ -0,0 +1,79 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +// Groups endpoints that share the same Route (ItemSpec in MSBuild terms). +// Multiple endpoints can share the same Route but point to different AssetFiles. +// MSBuild Remove operations match by ItemSpec, so removing an endpoint for one +// asset can accidentally remove endpoints for other assets with the same Route. +// This grouping enables correct filtering by tracking which endpoints share a route. +internal class StaticWebAssetEndpointGroup +{ + public string Route { get; set; } + + public List Items { get; } = new(); + + // Creates a dictionary grouping endpoints by Route. + internal static Dictionary CreateEndpointGroups( + StaticWebAssetEndpoint[] endpoints) + { + var groups = new Dictionary(StringComparer.Ordinal); + + foreach (var endpoint in endpoints) + { + if (!groups.TryGetValue(endpoint.Route, out var group)) + { + group = new StaticWebAssetEndpointGroup { Route = endpoint.Route }; + groups[endpoint.Route] = group; + } + + group.Items.Add(new StaticWebAssetEndpointGroupItem + { + AssetFile = endpoint.AssetFile, + Endpoint = endpoint + }); + } + + return groups; + } + + // Iterates over all endpoint groups and classifies each endpoint: + // - removed: endpoints whose asset was excluded + // - surviving: all endpoints that survived filtering (unaffected groups + + // endpoints from affected groups whose asset was not excluded) + internal static (List removed, List surviving) + ComputeFilteredEndpoints( + Dictionary groups, + HashSet excludedAssetFiles) + { + var removed = new List(); + var surviving = new List(); + + foreach (var group in groups.Values) + { + foreach (var item in group.Items) + { + if (!string.IsNullOrEmpty(item.AssetFile) && excludedAssetFiles.Contains(item.AssetFile)) + { + removed.Add(item.Endpoint); + } + else + { + surviving.Add(item.Endpoint); + } + } + } + + return (removed, surviving); + } +} + +internal class StaticWebAssetEndpointGroupItem +{ + public string AssetFile { get; set; } + + public StaticWebAssetEndpoint Endpoint { get; set; } +} diff --git a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetGroup.cs b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetGroup.cs new file mode 100644 index 000000000000..6b1515bab109 --- /dev/null +++ b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetGroup.cs @@ -0,0 +1,79 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using Microsoft.Build.Framework; + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +internal sealed class StaticWebAssetGroup +{ + private ITaskItem _originalItem; + private string _name; + private string _value; + private string _sourceId; + private bool? _deferred; + + public string Name + { + get => _name ??= _originalItem?.ItemSpec; + set => _name = value; + } + + public string Value + { + get => _value ??= _originalItem?.GetMetadata(nameof(Value)); + set => _value = value; + } + + public string SourceId + { + get => _sourceId ??= _originalItem?.GetMetadata(nameof(SourceId)); + set => _sourceId = value; + } + + public bool Deferred + { + get + { + _deferred ??= string.Equals(_originalItem?.GetMetadata(nameof(Deferred)), "true", StringComparison.OrdinalIgnoreCase); + return _deferred.Value; + } + set => _deferred = value; + } + + public static StaticWebAssetGroup FromTaskItem(ITaskItem item) + { + var group = new StaticWebAssetGroup { _originalItem = item }; + + if (string.IsNullOrEmpty(group.Name)) + { + throw new InvalidOperationException("A StaticWebAssetGroup is missing a required Name."); + } + + if (string.IsNullOrEmpty(group.SourceId)) + { + throw new InvalidOperationException($"Group '{group.Name}' is missing a required SourceId."); + } + + return group; + } + + public static Dictionary<(string SourceId, string Name), StaticWebAssetGroup> FromItemGroup(ITaskItem[] items) + { + if (items == null || items.Length == 0) + { + return new(); + } + + var result = new Dictionary<(string SourceId, string Name), StaticWebAssetGroup>(items.Length); + for (var i = 0; i < items.Length; i++) + { + var group = FromTaskItem(items[i]); + result[(group.SourceId, group.Name)] = group; + } + + return result; + } +} diff --git a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPackageManifest.cs b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPackageManifest.cs new file mode 100644 index 000000000000..95e7cef5effd --- /dev/null +++ b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPackageManifest.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +public class StaticWebAssetPackageManifest +{ + public const int CurrentVersion = 1; + public const string PackageManifestType = "Package"; + + public int Version { get; set; } = CurrentVersion; + + public string ManifestType { get; set; } = PackageManifestType; + + // Key: package-relative path (for example, staticwebassets/css/site.css) + // Value: static web asset metadata. + public Dictionary Assets { get; set; } = []; + + public StaticWebAssetEndpoint[] Endpoints { get; set; } = []; +} diff --git a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs index 5c9b48c486c2..3e1b4cbd2ad6 100644 --- a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs +++ b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs @@ -19,6 +19,7 @@ public sealed class StaticWebAssetPathPattern : IEquatable rawPathMemory AddTokenSegmentParts(tokenExpression, token); pattern.Segments.Add(token); - // Check if the segment is optional (ends with ? or !) + // Check if the segment is optional (ends with ? or !) or file-only (ends with ~) if (tokenEnd < current.Length - 1 && - (current.Span[tokenEnd + 1] == PatternOptional || current.Span[tokenEnd + 1] == PatternPreferred)) + (current.Span[tokenEnd + 1] == PatternOptional || current.Span[tokenEnd + 1] == PatternPreferred || current.Span[tokenEnd + 1] == PatternFileOnly)) { - token.IsOptional = true; - if (current.Span[tokenEnd + 1] == PatternPreferred) + if (current.Span[tokenEnd + 1] == PatternFileOnly) { + token.IsOptional = true; token.IsPreferred = true; + token.IsFileOnly = true; + } + else + { + token.IsOptional = true; + if (current.Span[tokenEnd + 1] == PatternPreferred) + { + token.IsPreferred = true; + } } tokenEnd++; } @@ -241,6 +251,25 @@ public static StaticWebAssetPathPattern Parse(string rawPath, string assetIdenti foreach (var tokenName in tokenNames) { var tokenNameString = tokenName.ToString(); + + // Check if any part has an embedded value for this token (e.g., {name=value}). + // Embedded values take precedence and don't require the resolver. + var hasEmbeddedValue = false; + foreach (var part in segment.Parts) + { + if (!part.IsLiteral && part.Name.Span.SequenceEqual(tokenName.Span) && !part.Value.IsEmpty) + { + hasEmbeddedValue = true; + dictionary[tokenNameString] = part.Value.ToString(); + break; + } + } + + if (hasEmbeddedValue) + { + continue; + } + if (!tokens.TryGetValue(staticWebAsset, tokenNameString, out var tokenValue) || string.IsNullOrEmpty(tokenValue)) { foundAllValues = false; @@ -304,16 +333,20 @@ public IEnumerable ExpandPatternExpression() // - other#[.{fingerprint}].js produces a single pattern asset#[.{fingerprint}].js // - last#[.{fingerprint}]?.txt produces two patterns last#[.{fingerprint}]?.txt and last.txt var hasOptionalSegments = false; + var hasFileOnlySegments = false; foreach (var segment in Segments) { if (segment.IsOptional) { hasOptionalSegments = true; - break; + } + if (segment.IsFileOnly) + { + hasFileOnlySegments = true; } } - if (!hasOptionalSegments) + if (!hasOptionalSegments && !hasFileOnlySegments) { return [this]; } @@ -322,6 +355,12 @@ public IEnumerable ExpandPatternExpression() for (var i = 0; i < Segments.Count; i++) { var segment = Segments[i]; + if (segment.IsFileOnly) + { + // File-only segments (~) are never included in endpoint routes. + // Skip them entirely — don't fork, don't add. + continue; + } if (IsLiteralSegment(segment) || !segment.IsOptional) { if (expandedPatternSegments.Count == 0) @@ -451,7 +490,11 @@ private static ReadOnlyMemory GetRawPattern(IList public bool IsPreferred { get; set; } + public bool IsFileOnly { get; set; } + public override bool Equals(object obj) => Equals(obj as StaticWebAssetPathSegment); public bool Equals(StaticWebAssetPathSegment other) => other is not null && Parts.SequenceEqual(other.Parts); @@ -51,7 +53,7 @@ internal string GetDebuggerDisplay() return Parts != null && Parts.Count == 1 && Parts[0].IsLiteral ? Parts[0].Name.ToString() : ComputeParameterExpression(); string ComputeParameterExpression() => - string.Concat(Parts.Select(p => p.IsLiteral ? p.Name.ToString() : $"{{{p.Name}}}").Prepend("#[").Append($"]{(IsOptional ? (IsPreferred ? "!" : "?") : "")}")); + string.Concat(Parts.Select(p => p.IsLiteral ? p.Name.ToString() : $"{{{p.Name}}}").Prepend("#[").Append($"]{(IsFileOnly ? "~" : IsOptional ? (IsPreferred ? "!" : "?") : "")}")); } internal ICollection> GetTokenNames() diff --git a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetTokenResolver.cs b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetTokenResolver.cs index c610324f9fef..4cc8bab3f246 100644 --- a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetTokenResolver.cs +++ b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetTokenResolver.cs @@ -21,6 +21,11 @@ internal virtual bool TryGetValue(StaticWebAsset asset, string key, out string v return true; } + if (asset.TryGetAssetGroupValue(key, out value)) + { + return true; + } + if (tokens == null) { value = null; diff --git a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs index 9f43c63845d1..d8e866f96cdb 100644 --- a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs @@ -22,6 +22,8 @@ namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; // path of the assets and so on. public partial class DefineStaticWebAssets : Task { + private static readonly char[] GroupPatternSeparator = [';']; + [Required] public ITaskItem[] CandidateAssets { get; set; } @@ -65,6 +67,8 @@ public partial class DefineStaticWebAssets : Task public string CacheManifestPath { get; set; } + public ITaskItem[] StaticWebAssetGroupDefinitions { get; set; } + [Output] public ITaskItem[] Assets { get; set; } @@ -85,12 +89,11 @@ public override bool Execute() var outputs = assetsCache.GetComputedOutputs(); Assets = [.. outputs.Assets]; CopyCandidates = [.. outputs.CopyCandidates]; - - return !Log.HasLoggedErrors; } - - try + else { + try + { var matcher = !string.IsNullOrEmpty(RelativePathPattern) ? new StaticWebAssetGlobMatcherBuilder().AddIncludePatterns(RelativePathPattern).Build() : null; @@ -291,6 +294,14 @@ public override bool Execute() fileLength, lastWriteTimeUtc); + // Preserve AssetGroups from the candidate if it already has one (e.g., compressed alternative + // inheriting from its primary asset) + var existingGroups = candidate.GetMetadata(nameof(StaticWebAsset.AssetGroups)); + if (!string.IsNullOrEmpty(existingGroups)) + { + asset.AssetGroups = existingGroups; + } + var item = asset.ToTaskItem(); if (SourceType == StaticWebAsset.SourceTypes.Discovered) { @@ -308,10 +319,17 @@ public override bool Execute() Assets = [.. outputs.Assets]; CopyCandidates = [.. outputs.CopyCandidates]; + } + catch (Exception ex) + { + Log.LogErrorFromException(ex); + } } - catch (Exception ex) + + if (!Log.HasLoggedErrors && StaticWebAssetGroupDefinitions != null && StaticWebAssetGroupDefinitions.Length > 0) { - Log.LogError(ex.ToString()); + Log.LogMessage(MessageImportance.Low, "Applying group definitions. Definitions count: {0}, Assets count: {1}", StaticWebAssetGroupDefinitions.Length, Assets.Length); + ApplyGroupDefinitions(); } return !Log.HasLoggedErrors; @@ -585,4 +603,237 @@ private string GetDiscoveryCandidateMatchPath(ITaskItem candidate) return computedPath; } + + private void ApplyGroupDefinitions() + { + var definitions = ParseGroupDefinitions(); + if (definitions == null) + { + return; // Error already logged + } + + var matchContext = StaticWebAssetGlobMatcher.CreateMatchContext(); + + for (var i = 0; i < Assets.Length; i++) + { + var asset = StaticWebAsset.FromTaskItem(Assets[i]); + var (groupEntries, newRelativePath, contentRootSuffix) = MatchAssetToDefinitions(asset, definitions, matchContext); + + if (groupEntries != null && groupEntries.Count > 0) + { + asset.AssetGroups = string.Join(";", groupEntries); + asset.RelativePath = newRelativePath; + if (contentRootSuffix != null) + { + ApplyContentRootSuffix(ref asset, contentRootSuffix.Value.Suffix, contentRootSuffix.Value.GroupName); + } + Assets[i] = asset.ToTaskItem(); + } + } + } + + private readonly struct GroupDefinition + { + public GroupDefinition( + string name, + string value, + string sourceId, + int order, + StaticWebAssetGlobMatcher includeMatcher, + StaticWebAssetGlobMatcher excludeMatcher, + StaticWebAssetGlobMatcher relativePathMatcher, + string relativePathPrefix, + string contentRootSuffix) + { + Name = name; + Value = value; + SourceId = sourceId; + Order = order; + IncludeMatcher = includeMatcher; + ExcludeMatcher = excludeMatcher; + RelativePathMatcher = relativePathMatcher; + RelativePathPrefix = relativePathPrefix; + ContentRootSuffix = contentRootSuffix; + } + + public string Name { get; } + public string Value { get; } + public string SourceId { get; } + public int Order { get; } + public StaticWebAssetGlobMatcher IncludeMatcher { get; } + public StaticWebAssetGlobMatcher ExcludeMatcher { get; } + public StaticWebAssetGlobMatcher RelativePathMatcher { get; } + public string RelativePathPrefix { get; } + public string ContentRootSuffix { get; } + } + + private List ParseGroupDefinitions() + { + var definitions = new List(); + + foreach (var def in StaticWebAssetGroupDefinitions) + { + var name = def.ItemSpec; + var value = def.GetMetadata("Value"); + var sourceId = def.GetMetadata("SourceId"); + var orderStr = def.GetMetadata("Order"); + if (!int.TryParse(orderStr, out var order)) + { + order = 0; + } + + var includePattern = def.GetMetadata("IncludePattern"); + var excludePattern = def.GetMetadata("ExcludePattern"); + var relativePathPattern = def.GetMetadata("RelativePathPattern"); + var relativePathPrefix = def.GetMetadata("RelativePathPrefix"); + var contentRootSuffix = def.GetMetadata("ContentRootSuffix"); + + StaticWebAssetGlobMatcher includeMatcher = null; + if (!string.IsNullOrEmpty(includePattern)) + { + includeMatcher = new StaticWebAssetGlobMatcherBuilder() + .AddIncludePatterns(includePattern.Split(GroupPatternSeparator, StringSplitOptions.RemoveEmptyEntries)) + .Build(); + } + + StaticWebAssetGlobMatcher excludeMatcher = null; + if (!string.IsNullOrEmpty(excludePattern)) + { + excludeMatcher = new StaticWebAssetGlobMatcherBuilder() + .AddIncludePatterns(excludePattern.Split(GroupPatternSeparator, StringSplitOptions.RemoveEmptyEntries)) + .Build(); + } + + StaticWebAssetGlobMatcher relativePathMatcher = null; + if (!string.IsNullOrEmpty(relativePathPattern)) + { + relativePathMatcher = new StaticWebAssetGlobMatcherBuilder() + .AddIncludePatterns(relativePathPattern) + .Build(); + } + + definitions.Add(new GroupDefinition(name, value, sourceId, order, includeMatcher, excludeMatcher, relativePathMatcher, relativePathPrefix, contentRootSuffix)); + } + + // Validate that no two definitions share the same (Order, SourceId) + for (var i = 0; i < definitions.Count; i++) + { + for (var j = i + 1; j < definitions.Count; j++) + { + if (definitions[i].Order == definitions[j].Order && + string.Equals(definitions[i].SourceId, definitions[j].SourceId, StringComparison.Ordinal)) + { + Log.LogError( + "Group definitions '{0}' and '{1}' have the same Order ({2}) and SourceId ('{3}'). " + + "Each definition from the same source must have a unique Order to ensure deterministic evaluation.", + definitions[i].Name, definitions[j].Name, definitions[i].Order, definitions[i].SourceId); + return null; + } + } + } + + definitions.Sort((a, b) => a.Order.CompareTo(b.Order)); + return definitions; + } + + private (List GroupEntries, string RelativePath, (string Suffix, string GroupName)? ContentRootSuffix) MatchAssetToDefinitions( + StaticWebAsset asset, List definitions, StaticWebAssetGlobMatcher.MatchContext matchContext) + { + var currentRelativePath = asset.RelativePath; + var pathWithoutTokens = StaticWebAssetPathPattern.PathWithoutTokens(currentRelativePath); + var groupEntries = new List(); + var groupValues = new Dictionary(StringComparer.Ordinal); + (string Suffix, string GroupName)? contentRootSuffix = null; + + foreach (var def in definitions) + { + if (def.IncludeMatcher == null) + { + Log.LogMessage(MessageImportance.Low, + "Skipping group definition '{0}' because it has no IncludePattern.", def.Name); + continue; + } + matchContext.SetPathAndReinitialize(pathWithoutTokens); + var includeMatch = def.IncludeMatcher.Match(matchContext); + + if (!includeMatch.IsMatch) + { + continue; + } + + if (def.ExcludeMatcher != null) + { + matchContext.SetPathAndReinitialize(pathWithoutTokens); + var excludeMatch = def.ExcludeMatcher.Match(matchContext); + if (excludeMatch.IsMatch) + { + Log.LogMessage(MessageImportance.Low, "Asset '{0}' excluded from group '{1}={2}' by ExcludePattern.", asset.Identity, def.Name, def.Value); + continue; + } + } + + if (groupValues.TryGetValue(def.Name, out var existingValue)) + { + if (!string.Equals(existingValue, def.Value, StringComparison.Ordinal)) + { + Log.LogError("Asset '{0}' matched group definitions for '{1}' with conflicting values '{2}' and '{3}'. Glob patterns must be non-overlapping for the same group name with different values.", + asset.Identity, def.Name, existingValue, def.Value); + return (null, null, null); + } + continue; + } + + groupValues.Add(def.Name, def.Value); + groupEntries.Add(def.Name + "=" + def.Value); + Log.LogMessage(MessageImportance.Low, "Tagged asset '{0}' with group '{1}={2}'.", asset.Identity, def.Name, def.Value); + + if (def.RelativePathMatcher != null) + { + matchContext.SetPathAndReinitialize(pathWithoutTokens); + var rpMatch = def.RelativePathMatcher.Match(matchContext); + if (rpMatch.IsMatch) + { + // Safe to use pathWithoutTokens here: DefineStaticWebAssets runs on raw + // Content items before fingerprint/token expressions are applied. + var newRelativePath = StaticWebAsset.Normalize(rpMatch.Stem); + + if (!string.IsNullOrEmpty(def.RelativePathPrefix)) + { + newRelativePath = def.RelativePathPrefix + newRelativePath; + Log.LogMessage(MessageImportance.Low, "Group '{0}' prepended RelativePathPrefix '{1}' to relative path.", def.Name, def.RelativePathPrefix); + } + + Log.LogMessage(MessageImportance.Low, "Group '{0}' transformed RelativePath from '{1}' to '{2}'.", + def.Name, currentRelativePath, newRelativePath); + + currentRelativePath = newRelativePath; + pathWithoutTokens = StaticWebAssetPathPattern.PathWithoutTokens(currentRelativePath); + } + } + + if (!string.IsNullOrEmpty(def.RelativePathPrefix) && def.RelativePathMatcher == null) + { + currentRelativePath = def.RelativePathPrefix + currentRelativePath; + pathWithoutTokens = StaticWebAssetPathPattern.PathWithoutTokens(currentRelativePath); + Log.LogMessage(MessageImportance.Low, "Group '{0}' prepended RelativePathPrefix '{1}' to relative path.", def.Name, def.RelativePathPrefix); + } + + if (!string.IsNullOrEmpty(def.ContentRootSuffix)) + { + contentRootSuffix = (def.ContentRootSuffix, def.Name); + } + } + + return (groupEntries, currentRelativePath, contentRootSuffix); + } + + private void ApplyContentRootSuffix(ref StaticWebAsset asset, string contentRootSuffix, string groupName) + { + var normalizedContentRoot = asset.ContentRoot.TrimEnd('/', '\\'); + var normalizedSuffix = contentRootSuffix.Trim('/', '\\'); + asset.ContentRoot = StaticWebAsset.NormalizeContentRootPath(normalizedContentRoot + "/" + normalizedSuffix); + Log.LogMessage(MessageImportance.Low, + "Group '{0}' adjusted ContentRoot to '{1}' via ContentRootSuffix.", + groupName, asset.ContentRoot); + } } diff --git a/src/StaticWebAssetsSdk/Tasks/FilterStaticWebAssetGroups.cs b/src/StaticWebAssetsSdk/Tasks/FilterStaticWebAssetGroups.cs new file mode 100644 index 000000000000..a56064e53552 --- /dev/null +++ b/src/StaticWebAssetsSdk/Tasks/FilterStaticWebAssetGroups.cs @@ -0,0 +1,110 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using Microsoft.Build.Framework; + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +// Unified task for filtering assets and endpoints by group declarations. +// When SkipDeferred=true (first pass / pre-filter), groups marked Deferred are skipped. +// When SkipDeferred=false (final pass), all groups must be concrete — an error is raised +// if any group is still marked Deferred. +public class FilterStaticWebAssetGroups : Task +{ + [Required] + public ITaskItem[] Assets { get; set; } + + [Required] + public ITaskItem[] Endpoints { get; set; } + + public ITaskItem[] StaticWebAssetGroups { get; set; } + + // When provided, only assets with matching SourceId are filtered; others pass through. + public string Source { get; set; } + + // When true, groups marked Deferred are skipped (first-pass pre-filter). + public bool SkipDeferred { get; set; } + + [Output] + public ITaskItem[] FilteredAssets { get; set; } + + // Endpoints whose asset was excluded by group filtering. + [Output] + public ITaskItem[] RemovedEndpoints { get; set; } + + // All endpoints that survived group filtering (unaffected groups + + // endpoints from affected groups whose asset was not excluded). + [Output] + public ITaskItem[] SurvivingEndpoints { get; set; } + + public override bool Execute() + { + var groups = StaticWebAssetGroup.FromItemGroup(StaticWebAssetGroups); + + if (groups.Count == 0) + { + FilteredAssets = Assets; + RemovedEndpoints = []; + SurvivingEndpoints = Endpoints; + return true; + } + + if (!SkipDeferred) + { + foreach (var group in groups.Values) + { + if (group.Deferred) + { + Log.LogError( + "Group '{0}' for source '{1}' is still marked as Deferred during final evaluation. " + + "Deferred groups must be resolved before the final filtering pass.", + group.Name, group.SourceId); + return false; + } + } + } + + var parsedAssets = StaticWebAsset.FromTaskItemGroup(Assets); + var (_, excludedAssetFiles) = StaticWebAsset.FilterByGroup(parsedAssets, groups, SkipDeferred, Source); + + // Null out excluded entries in-place — MSBuild ignores null ITaskItem[] entries, + // so we avoid allocating a new list and re-serializing included assets. + for (var i = 0; i < Assets.Length; i++) + { + if (excludedAssetFiles.Contains(Assets[i].ItemSpec)) + { + Assets[i] = null; + } + } + + FilteredAssets = Assets; + + var parsedEndpoints = StaticWebAssetEndpoint.FromItemGroup(Endpoints); + + if (excludedAssetFiles.Count > 0) + { + var endpointGroups = StaticWebAssetEndpointGroup.CreateEndpointGroups(parsedEndpoints); + var (removedEndpoints, survivingEndpoints) = + StaticWebAssetEndpointGroup.ComputeFilteredEndpoints(endpointGroups, excludedAssetFiles); + + foreach (var endpoint in removedEndpoints) + { + Log.LogMessage(MessageImportance.Low, + "Excluding endpoint '{0}' because its asset file '{1}' was excluded by group filtering.", + endpoint.Route, endpoint.AssetFile); + } + + RemovedEndpoints = StaticWebAssetEndpoint.ToTaskItems(removedEndpoints); + SurvivingEndpoints = StaticWebAssetEndpoint.ToTaskItems(survivingEndpoints); + } + else + { + RemovedEndpoints = []; + SurvivingEndpoints = StaticWebAssetEndpoint.ToTaskItems(parsedEndpoints); + } + + return !Log.HasLoggedErrors; + } +} diff --git a/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs b/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs new file mode 100644 index 000000000000..b4b4f28008d6 --- /dev/null +++ b/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs @@ -0,0 +1,176 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using Microsoft.AspNetCore.StaticWebAssets.Tasks.Utils; +using Microsoft.Build.Framework; + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +// Generates a JSON manifest file containing both static web asset and endpoint data +// for inclusion in a NuGet package. Replaces the pair of XML .props generators +// (GenerateStaticWebAssetsPropsFile + GenerateStaticWebAssetEndpointsPropsFile) for +// the new .targets-based packaging path (net11.0+). +public class GeneratePackageAssetsManifestFile : Task +{ + [Required] + public ITaskItem[] StaticWebAssets { get; set; } + + [Required] + public ITaskItem[] StaticWebAssetEndpoints { get; set; } + + [Required] + public string TargetManifestPath { get; set; } + + public string PackagePathPrefix { get; set; } = "staticwebassets"; + + public string FrameworkPattern { get; set; } + + public override bool Execute() + { + if (StaticWebAssets.Length == 0) + { + return !Log.HasLoggedErrors; + } + + var tokenResolver = StaticWebAssetTokenResolver.Instance; + + var frameworkMatcher = CreateFrameworkMatcher(); + var hasFrameworkMatcher = frameworkMatcher != null; + var matchContext = hasFrameworkMatcher ? StaticWebAssetGlobMatcher.CreateMatchContext() : default; + + // Parse all assets once and pre-compute package-relative paths. + var parsedAssets = StaticWebAsset.FromTaskItemGroup(StaticWebAssets); + var (identityToPackagePath, packagePaths) = ComputePackagePaths(parsedAssets, tokenResolver); + + var assets = BuildManifestAssets(parsedAssets, packagePaths, identityToPackagePath, frameworkMatcher, matchContext); + if (assets == null) + { + return false; + } + + var manifestEndpoints = BuildManifestEndpoints(identityToPackagePath); + + var manifest = new StaticWebAssetPackageManifest + { + Version = StaticWebAssetPackageManifest.CurrentVersion, + ManifestType = StaticWebAssetPackageManifest.PackageManifestType, + Assets = assets, + Endpoints = manifestEndpoints, + }; + + this.PersistFileIfChanged(manifest, TargetManifestPath, + StaticWebAssetsJsonSerializerContext.RelaxedEscaping.StaticWebAssetPackageManifest); + + return !Log.HasLoggedErrors; + } + + private StaticWebAssetGlobMatcher CreateFrameworkMatcher() + { + if (string.IsNullOrEmpty(FrameworkPattern)) + { + return null; + } + + var patterns = FrameworkPattern + .Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries) + .Select(s => s.Trim()) + .ToArray(); + return new StaticWebAssetGlobMatcherBuilder() + .AddIncludePatterns(patterns) + .Build(); + } + + private (Dictionary IdentityToPackagePath, string[] PackagePaths) ComputePackagePaths( + StaticWebAsset[] parsedAssets, StaticWebAssetTokenResolver tokenResolver) + { + var identityToPackagePath = new Dictionary(parsedAssets.Length, Utils.OSPath.PathComparer); + var packagePaths = new string[parsedAssets.Length]; + for (var i = 0; i < parsedAssets.Length; i++) + { + var packagePath = parsedAssets[i].ComputeTargetPath(PackagePathPrefix, '/', tokenResolver); + identityToPackagePath[parsedAssets[i].Identity] = packagePath; + packagePaths[i] = packagePath; + } + return (identityToPackagePath, packagePaths); + } + + private Dictionary BuildManifestAssets( + StaticWebAsset[] parsedAssets, + string[] packagePaths, + Dictionary identityToPackagePath, + StaticWebAssetGlobMatcher frameworkMatcher, + StaticWebAssetGlobMatcher.MatchContext matchContext) + { + var hasFrameworkMatcher = frameworkMatcher != null; + var assets = new Dictionary(OSPath.PathComparer); + + // Sort indices by BasePath then RelativePath for deterministic output. + var indices = Enumerable.Range(0, parsedAssets.Length) + .OrderBy(i => parsedAssets[i].BasePath, StringComparer.OrdinalIgnoreCase) + .ThenBy(i => parsedAssets[i].RelativePath, StringComparer.OrdinalIgnoreCase); + + foreach (var i in indices) + { + var asset = parsedAssets[i]; + var relativePath = asset.RelativePath; + var packagePath = packagePaths[i]; + + var emittedSourceType = StaticWebAsset.SourceTypes.Package; + if (hasFrameworkMatcher) + { + matchContext.SetPathAndReinitialize(relativePath.AsSpan()); + var match = frameworkMatcher.Match(matchContext); + if (match.IsMatch) + { + emittedSourceType = StaticWebAsset.SourceTypes.Framework; + } + } + + // Remap RelatedAsset from build-time absolute path to package-relative path + var relatedAssetValue = asset.RelatedAsset; + if (!string.IsNullOrEmpty(relatedAssetValue) && + identityToPackagePath.TryGetValue(relatedAssetValue, out var remappedRelatedAsset)) + { + relatedAssetValue = remappedRelatedAsset; + } + else if (!string.IsNullOrEmpty(relatedAssetValue)) + { + Log.LogError( + "Asset '{0}' has RelatedAsset '{1}' which could not be mapped to a package-relative path. " + + "This indicates a graph inconsistency — the related asset is not part of the package.", + asset.Identity, relatedAssetValue); + return null; + } + + var manifestAsset = new StaticWebAsset(asset) + { + Identity = packagePath, + SourceType = emittedSourceType, + RelatedAsset = relatedAssetValue + }; + + assets[packagePath] = manifestAsset; + } + + return assets; + } + + private StaticWebAssetEndpoint[] BuildManifestEndpoints(Dictionary identityToPackagePath) + { + var endpoints = StaticWebAssetEndpoint.FromItemGroup(StaticWebAssetEndpoints); + var manifestEndpoints = new List(); + foreach (var endpoint in endpoints.OrderBy(e => e.Route, StringComparer.OrdinalIgnoreCase) + .ThenBy(e => e.AssetFile, StringComparer.OrdinalIgnoreCase)) + { + // Remap AssetFile to package-relative path + if (identityToPackagePath.TryGetValue(endpoint.AssetFile, out var packageRelativePath)) + { + endpoint.AssetFile = packageRelativePath; + } + manifestEndpoints.Add(endpoint); + } + return manifestEndpoints.ToArray(); + } +} diff --git a/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsTargetsFile.cs b/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsTargetsFile.cs new file mode 100644 index 000000000000..f027e44fd209 --- /dev/null +++ b/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsTargetsFile.cs @@ -0,0 +1,66 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using System.Xml; +using Microsoft.AspNetCore.StaticWebAssets.Tasks.Utils; +using Microsoft.Build.Framework; + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +// Generates a lightweight .targets file that adds a single StaticWebAssetPackageManifest +// item pointing to the JSON manifest file. This replaces the heavyweight XML .props files +// that contained all asset/endpoint data as MSBuild items. +public class GeneratePackageAssetsTargetsFile : Task +{ + [Required] + public string PackageId { get; set; } + + [Required] + public string TargetFilePath { get; set; } + + public string PackagePathPrefix { get; set; } = "staticwebassets"; + + [Required] + public string ManifestFileName { get; set; } + + public override bool Execute() + { + var normalizedPrefix = PackagePathPrefix.Replace("/", "\\").TrimStart('\\'); + + var itemGroup = new XElement("ItemGroup"); + var manifestItem = new XElement("StaticWebAssetPackageManifest", + new XAttribute("Include", $@"$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory){ManifestFileName}'))"), + new XElement("SourceId", PackageId), + new XElement("ContentRoot", $@"$(MSBuildThisFileDirectory)..\{normalizedPrefix}\"), + new XElement("PackageRoot", @"$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..'))")); + + itemGroup.Add(manifestItem); + + var document = new XDocument(new XDeclaration("1.0", "utf-8", "yes")); + var root = new XElement("Project", itemGroup); + document.Add(root); + + var settings = new XmlWriterSettings + { + Encoding = Encoding.UTF8, + CloseOutput = false, + OmitXmlDeclaration = true, + Indent = true, + NewLineOnAttributes = false, + Async = true + }; + + using var memoryStream = new MemoryStream(); + using (var xmlWriter = XmlWriter.Create(memoryStream, settings)) + { + document.WriteTo(xmlWriter); + } + + var data = memoryStream.ToArray(); + this.PersistFileIfChanged(data, TargetFilePath); + + return !Log.HasLoggedErrors; + } +} diff --git a/src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetsManifest.cs b/src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetsManifest.cs index af3d46ff6caf..d802e5342109 100644 --- a/src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetsManifest.cs +++ b/src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetsManifest.cs @@ -57,9 +57,10 @@ public override bool Execute() Log.LogMessage(MessageImportance.Low, "Generating manifest for '{0}' assets and '{1}' endpoints", assets.Length, endpoints.Length); var assetsByTargetPath = GroupAssetsByTargetPath(assets); + var groupSet = new HashSet(StringComparer.Ordinal); foreach (var group in assetsByTargetPath) { - if (!StaticWebAsset.ValidateAssetGroup(group.Key, group.Value, out var reason)) + if (!StaticWebAsset.ValidateAssetGroup(group.Key, group.Value, out var reason, groupSet)) { Log.LogError(reason); return false; diff --git a/src/StaticWebAssetsSdk/Tasks/ReadPackageAssetsManifest.cs b/src/StaticWebAssetsSdk/Tasks/ReadPackageAssetsManifest.cs new file mode 100644 index 000000000000..ab9e0ed59adb --- /dev/null +++ b/src/StaticWebAssetsSdk/Tasks/ReadPackageAssetsManifest.cs @@ -0,0 +1,218 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using System.Text.Json; +using Microsoft.AspNetCore.StaticWebAssets.Tasks.Utils; +using Microsoft.Build.Framework; + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +// Reads StaticWebAssetPackageManifest items, deserializes the JSON manifests, +// applies group filtering, and emits matching assets and endpoints as MSBuild items. +// This replaces the eager import of XML .props files with a task-based read-and-filter approach. +public class ReadPackageAssetsManifest : Task +{ + [Required] + public ITaskItem[] PackageManifests { get; set; } + + public ITaskItem[] StaticWebAssetGroups { get; set; } + + public string IntermediateOutputPath { get; set; } + + public string ProjectPackageId { get; set; } + + public string ProjectBasePath { get; set; } + + [Output] + public ITaskItem[] Assets { get; set; } + + [Output] + public ITaskItem[] Endpoints { get; set; } + + public override bool Execute() + { + var groupLookup = StaticWebAssetGroup.FromItemGroup(StaticWebAssetGroups); + var allAssets = new List(); + var allEndpoints = new List(); + + foreach (var manifestItem in PackageManifests) + { + var manifestPath = manifestItem.ItemSpec; + var sourceId = manifestItem.GetMetadata("SourceId"); + var packageRoot = manifestItem.GetMetadata("PackageRoot"); + var contentRoot = manifestItem.GetMetadata("ContentRoot"); + + if (!File.Exists(manifestPath)) + { + Log.LogError("Package manifest file '{0}' not found.", manifestPath); + return false; + } + + var manifest = ReadManifest(manifestPath); + if (manifest == null) + { + return false; + } + + if (manifest.Assets == null || manifest.Assets.Count == 0) + { + continue; + } + + // Copy manifest assets — Identity and RelatedAsset are already + // package-relative paths as written by GeneratePackageAssetsManifestFile. + var assets = new StaticWebAsset[manifest.Assets.Count]; + var index = 0; + foreach (var entry in manifest.Assets) + { + var asset = new StaticWebAsset(entry.Value); + assets[index++] = asset; + } + + var (includedAssets, excludedPaths) = StaticWebAsset.FilterByGroup(assets, groupLookup, skipDeferred: true); + + // Filter endpoints on raw package-relative paths before resolving anything. + var endpointGroups = StaticWebAssetEndpointGroup.CreateEndpointGroups(manifest.Endpoints ?? []); + var (_, includedEndpoints) = StaticWebAssetEndpointGroup.ComputeFilteredEndpoints(endpointGroups, excludedPaths); + + if (!ResolveAssetsAndEndpoints(includedAssets, includedEndpoints, sourceId, packageRoot, contentRoot)) + { + return false; + } + + allAssets.AddRange(includedAssets); + allEndpoints.AddRange(includedEndpoints); + } + + Assets = allAssets.Select(asset => asset.ToTaskItem()).ToArray(); + Endpoints = StaticWebAssetEndpoint.ToTaskItems(allEndpoints); + + return !Log.HasLoggedErrors; + } + + // Resolve paths — framework assets materialize into the fx intermediate + // folder; everything else resolves against the package root. + // Build a lookup for framework asset identities so RelatedAsset and + // endpoint.AssetFile references can resolve to the materialized path. + private bool ResolveAssetsAndEndpoints( + List assets, + List endpoints, + string sourceId, + string packageRoot, + string contentRoot) + { + var fxDir = Path.Combine(IntermediateOutputPath, "fx", sourceId); + var frameworkPaths = new Dictionary(OSPath.PathComparer); + var normalizedContentRoot = StaticWebAsset.NormalizeContentRootPath(contentRoot); + + foreach (var asset in assets) + { + if (StaticWebAsset.SourceTypes.IsFramework(asset.SourceType)) + { + var resolvedRelativePath = StaticWebAssetPathPattern.PathWithoutTokens(asset.RelativePath); + var destPath = Path.GetFullPath(Path.Combine(fxDir, resolvedRelativePath)); + frameworkPaths[asset.Identity] = destPath; + MaterializeFrameworkAsset(asset, packageRoot, fxDir, destPath); + if (Log.HasLoggedErrors) + { + return false; + } + } + else + { + asset.Identity = ResolvePath(packageRoot, asset.Identity); + asset.OriginalItemSpec = asset.Identity; + asset.ContentRoot = normalizedContentRoot; + } + + if (!string.IsNullOrEmpty(asset.RelatedAsset)) + { + asset.RelatedAsset = frameworkPaths.TryGetValue(asset.RelatedAsset, out var fxRelated) + ? fxRelated + : ResolvePath(packageRoot, asset.RelatedAsset); + } + } + + foreach (var endpoint in endpoints) + { + endpoint.AssetFile = frameworkPaths.TryGetValue(endpoint.AssetFile, out var fxEp) + ? fxEp + : ResolvePath(packageRoot, endpoint.AssetFile); + } + + return true; + } + + private StaticWebAssetPackageManifest ReadManifest(string manifestPath) + { + StaticWebAssetPackageManifest manifest; + try + { + var json = File.ReadAllBytes(manifestPath); + manifest = JsonSerializer.Deserialize(json, + StaticWebAssetsJsonSerializerContext.Default.StaticWebAssetPackageManifest); + } + catch (Exception ex) + { + Log.LogError("Failed to read package manifest '{0}': {1}", manifestPath, ex.Message); + return null; + } + + if (manifest is null) + { + Log.LogError("Package manifest '{0}' deserialized to null.", manifestPath); + return null; + } + + if (manifest.Version != StaticWebAssetPackageManifest.CurrentVersion) + { + Log.LogError("Unsupported package manifest version {0} in '{1}'. Expected version {2}.", manifest.Version, manifestPath, StaticWebAssetPackageManifest.CurrentVersion); + return null; + } + + if (!string.Equals(manifest.ManifestType, StaticWebAssetPackageManifest.PackageManifestType, StringComparison.Ordinal)) + { + Log.LogError("Unexpected manifest type '{0}' in '{1}'. Expected '{2}'.", manifest.ManifestType, manifestPath, StaticWebAssetPackageManifest.PackageManifestType); + return null; + } + + return manifest; + } + + private void MaterializeFrameworkAsset( + StaticWebAsset asset, + string packageRoot, + string fxDir, + string destPath) + { + var sourcePath = ResolvePath(packageRoot, asset.Identity); + + if (!File.Exists(sourcePath)) + { + Log.LogError("Source file '{0}' does not exist for framework asset materialization.", sourcePath); + return; + } + + Directory.CreateDirectory(Path.GetDirectoryName(destPath)); + + if (!File.Exists(destPath) || File.GetLastWriteTimeUtc(sourcePath) > File.GetLastWriteTimeUtc(destPath)) + { + File.Copy(sourcePath, destPath, overwrite: true); + } + + asset.Identity = destPath; + asset.OriginalItemSpec = destPath; + asset.SourceType = StaticWebAsset.SourceTypes.Discovered; + asset.SourceId = ProjectPackageId; + asset.ContentRoot = StaticWebAsset.NormalizeContentRootPath(fxDir); + asset.BasePath = ProjectBasePath; + asset.AssetMode = StaticWebAsset.AssetModes.CurrentProject; + } + + private static string ResolvePath(string packageRoot, string relativePath) + { + return Path.GetFullPath(Path.Combine(packageRoot, relativePath.Replace('/', Path.DirectorySeparatorChar))); + } +} diff --git a/src/StaticWebAssetsSdk/Tasks/UpdateExternallyDefinedStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/UpdateExternallyDefinedStaticWebAssets.cs index f991eaff1795..a918fd6a8458 100644 --- a/src/StaticWebAssetsSdk/Tasks/UpdateExternallyDefinedStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/UpdateExternallyDefinedStaticWebAssets.cs @@ -25,6 +25,8 @@ public class UpdateExternallyDefinedStaticWebAssets : Task public ITaskItem[] FingerprintInferenceExpressions { get; set; } + public ITaskItem[] StaticWebAssetGroups { get; set; } + [Output] public ITaskItem[] UpdatedAssets { get; set; } @@ -38,6 +40,7 @@ public override bool Execute() { var assets = Assets.Select(StaticWebAsset.FromV1TaskItem).ToArray(); var endpoints = StaticWebAssetEndpoint.FromItemGroup(Endpoints); + var groupLookup = StaticWebAssetGroup.FromItemGroup(StaticWebAssetGroups); var endpointByAsset = endpoints .GroupBy(e => e.AssetFile, OSPath.PathComparer) .ToDictionary(e => e.Key, e => e.ToArray(), OSPath.PathComparer); @@ -64,9 +67,17 @@ public override bool Execute() } } - UpdatedAssets = assets.Select(a => a.ToTaskItem()).ToArray(); - UpdatedEndpoints = endpoints.Select(e => e.ToTaskItem()).ToArray(); - AssetsWithoutEndpoints = assetsWithoutEndpoints.Select(a => a.ToTaskItem()).ToArray(); + var (filteredAssets, excludedAssetFiles) = StaticWebAsset.FilterByGroup(assets, groupLookup, skipDeferred: true); + + UpdatedAssets = StaticWebAsset.ToTaskItems(filteredAssets); + + // Filter endpoints using the shared helper. + var endpointGroups = StaticWebAssetEndpointGroup.CreateEndpointGroups(endpoints); + var (_, survivingEndpoints) = StaticWebAssetEndpointGroup.ComputeFilteredEndpoints(endpointGroups, excludedAssetFiles); + UpdatedEndpoints = StaticWebAssetEndpoint.ToTaskItems(survivingEndpoints); + + AssetsWithoutEndpoints = StaticWebAsset.ToTaskItems( + assetsWithoutEndpoints.Where(a => !excludedAssetFiles.Contains(a.Identity))); return !Log.HasLoggedErrors; } From d540ae4e21420d48f7111601ebe5590ec5f84f30 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 14:21:24 +0100 Subject: [PATCH 02/20] Add test assets for asset groups integration tests Add AssetGroupsSample test project with: - IdentityUILib: library with V4/V5 versioned wwwroot assets and StaticWebAssets.Groups.targets defining the group structure - IdentityUIConsumer: basic consumer referencing IdentityUILib - IdentityUIConsumerV4/V5: consumers that select specific asset groups Update AppWithPackageAndP2PReference.csproj to support pack testing with the new JSON manifest format. --- .../IdentityUIConsumer.csproj | 27 +++++++++++++++ .../IdentityUIConsumer/Program.cs | 9 +++++ .../IdentityUIConsumerV4.csproj | 29 ++++++++++++++++ .../IdentityUIConsumerV4/Program.cs | 9 +++++ .../IdentityUIConsumerV5.csproj | 29 ++++++++++++++++ .../IdentityUIConsumerV5/Program.cs | 9 +++++ .../IdentityUILib/IdentityUILib.csproj | 33 +++++++++++++++++++ .../StaticWebAssets.Groups.targets | 8 +++++ .../IdentityUILib/wwwroot/V4/css/site.css | 9 +++++ .../IdentityUILib/wwwroot/V4/js/site.js | 4 +++ .../IdentityUILib/wwwroot/V5/css/site.css | 9 +++++ .../IdentityUILib/wwwroot/V5/js/site.js | 4 +++ .../AppWithPackageAndP2PReference.csproj | 11 +++---- 13 files changed, 183 insertions(+), 7 deletions(-) create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumer/IdentityUIConsumer.csproj create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumer/Program.cs create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV4/IdentityUIConsumerV4.csproj create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV4/Program.cs create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV5/IdentityUIConsumerV5.csproj create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV5/Program.cs create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/IdentityUILib.csproj create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/StaticWebAssets.Groups.targets create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V4/css/site.css create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V4/js/site.js create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V5/css/site.css create mode 100644 test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V5/js/site.js diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumer/IdentityUIConsumer.csproj b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumer/IdentityUIConsumer.csproj new file mode 100644 index 000000000000..d67dcc902b4c --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumer/IdentityUIConsumer.csproj @@ -0,0 +1,27 @@ + + + + $(AspNetTestTfm) + + + + false + + + + + + + + + + + + + + + + + diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumer/Program.cs b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumer/Program.cs new file mode 100644 index 000000000000..b5f4ea80b38a --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumer/Program.cs @@ -0,0 +1,9 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +var builder = WebApplication.CreateBuilder(args); +var app = builder.Build(); +app.MapStaticAssets(); +app.MapGet("/", () => "Hello World!"); +app.Run(); diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV4/IdentityUIConsumerV4.csproj b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV4/IdentityUIConsumerV4.csproj new file mode 100644 index 000000000000..d4c9227be40c --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV4/IdentityUIConsumerV4.csproj @@ -0,0 +1,29 @@ + + + + $(AspNetTestTfm) + + + + false + + V4 + + + + + + + + + + + + + + + + + diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV4/Program.cs b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV4/Program.cs new file mode 100644 index 000000000000..b5f4ea80b38a --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV4/Program.cs @@ -0,0 +1,9 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +var builder = WebApplication.CreateBuilder(args); +var app = builder.Build(); +app.MapStaticAssets(); +app.MapGet("/", () => "Hello World!"); +app.Run(); diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV5/IdentityUIConsumerV5.csproj b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV5/IdentityUIConsumerV5.csproj new file mode 100644 index 000000000000..00851c8caf54 --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV5/IdentityUIConsumerV5.csproj @@ -0,0 +1,29 @@ + + + + $(AspNetTestTfm) + + + + false + + V5 + + + + + + + + + + + + + + + + + diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV5/Program.cs b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV5/Program.cs new file mode 100644 index 000000000000..b5f4ea80b38a --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUIConsumerV5/Program.cs @@ -0,0 +1,9 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +var builder = WebApplication.CreateBuilder(args); +var app = builder.Build(); +app.MapStaticAssets(); +app.MapGet("/", () => "Hello World!"); +app.Run(); diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/IdentityUILib.csproj b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/IdentityUILib.csproj new file mode 100644 index 000000000000..8aa4b18be7fc --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/IdentityUILib.csproj @@ -0,0 +1,33 @@ + + + + $(AspNetTestTfm) + true + © Microsoft + Asset Groups Test + Microsoft + Library producing grouped assets (Bootstrap V4/V5 variants) + false + + Identity + + $(AspNetTestPackageSource) + 1.0.0 + + + + false + + + + + + + + + + + + + + diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/StaticWebAssets.Groups.targets b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/StaticWebAssets.Groups.targets new file mode 100644 index 000000000000..15c5344844db --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/StaticWebAssets.Groups.targets @@ -0,0 +1,8 @@ + + + V5 + + + + + diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V4/css/site.css b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V4/css/site.css new file mode 100644 index 000000000000..eb4a85667063 --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V4/css/site.css @@ -0,0 +1,9 @@ +/* Bootstrap 4 variant - site.css */ +body { + font-family: Arial, sans-serif; + background-color: #f8f9fa; +} +.identity-container { + max-width: 1200px; + margin: 0 auto; +} diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V4/js/site.js b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V4/js/site.js new file mode 100644 index 000000000000..43c61a99203f --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V4/js/site.js @@ -0,0 +1,4 @@ +// Bootstrap 4 variant - site.js +(function() { + console.log("Identity UI - Bootstrap 4"); +})(); diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V5/css/site.css b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V5/css/site.css new file mode 100644 index 000000000000..96d1646b597b --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V5/css/site.css @@ -0,0 +1,9 @@ +/* Bootstrap 5 variant - site.css */ +body { + font-family: 'Segoe UI', system-ui, sans-serif; + background-color: #ffffff; +} +.identity-container { + max-width: 1320px; + margin: 0 auto; +} diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V5/js/site.js b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V5/js/site.js new file mode 100644 index 000000000000..4019503fce14 --- /dev/null +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/wwwroot/V5/js/site.js @@ -0,0 +1,4 @@ +// Bootstrap 5 variant - site.js +(function() { + console.log("Identity UI - Bootstrap 5"); +})(); diff --git a/test/TestAssets/TestProjects/RazorAppWithPackageAndP2PReference/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj b/test/TestAssets/TestProjects/RazorAppWithPackageAndP2PReference/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj index 11a0cca1f4e0..0a51e815a956 100644 --- a/test/TestAssets/TestProjects/RazorAppWithPackageAndP2PReference/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj +++ b/test/TestAssets/TestProjects/RazorAppWithPackageAndP2PReference/AppWithPackageAndP2PReference/AppWithPackageAndP2PReference.csproj @@ -22,17 +22,14 @@ Text="Packages are not being restored into the expected directory. Ensure that NUGET_PACKAGES and AspNetNugetIsolationPath are set as environment variables. The test should extend IsolatedNuGetPackageFolderAspNetSdkBaselineTest. RestorePackagesPath = '$(RestorePackagesPath)', AspNetNugetIsolationPath = '$(AspNetNugetIsolationPath)'" /> - - - <_LocalStaticAssetPath>$(AspNetNugetIsolationPath)\razorpackagelibrarydirectdependency\1.0.2\build\..\staticwebassets\ - - + <_RazorPackageLibraryDirectDependencyAssets Include="@(StaticWebAsset)" Condition="'%(SourceId)' == 'RazorPackageLibraryDirectDependency'" /> - <_LocalStaticWebAsset Include="@(_RazorPackageLibraryDirectDependencyAssets)" Condition="'%(ContentRoot)' == '$(_LocalStaticAssetPath)'" /> - + From eb057e644bd5ff7a6791da9249428ab3b9307348 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 14:21:45 +0100 Subject: [PATCH 03/20] Add unit tests for asset groups and JSON manifest packaging Unit tests covering: - AssetGroupFilteringTest: end-to-end group filtering scenarios - FilterStaticWebAssetGroupsTest: two-pass filtering logic (SkipDeferred) - GeneratePackageAssetsManifestFileTest: JSON manifest serialization - GeneratePackageAssetsTargetsFileTest: lightweight .targets generation - ReadPackageAssetsManifestTest: manifest deserialization and group filtering - ResolveCompressedAssetsTest: compression with asset groups - StaticWebAssetTest: AssetGroups property and related asset sorting --- .../AssetGroupFilteringTest.cs | 727 ++++++++++++++++++ .../FilterStaticWebAssetGroupsTest.cs | 290 +++++++ .../GeneratePackageAssetsManifestFileTest.cs | 249 ++++++ .../GeneratePackageAssetsTargetsFileTest.cs | 131 ++++ .../ReadPackageAssetsManifestTest.cs | 440 +++++++++++ .../ResolveCompressedAssetsTest.cs | 305 +++----- .../StaticWebAssets/StaticWebAssetTest.cs | 273 ++++++- 7 files changed, 2215 insertions(+), 200 deletions(-) create mode 100644 test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs create mode 100644 test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/FilterStaticWebAssetGroupsTest.cs create mode 100644 test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsManifestFileTest.cs create mode 100644 test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsTargetsFileTest.cs create mode 100644 test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadPackageAssetsManifestTest.cs diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs new file mode 100644 index 000000000000..f1724f164ee4 --- /dev/null +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs @@ -0,0 +1,727 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Moq; + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +/// +/// Unit tests for asset-group filtering logic across UpdatePackageStaticWebAssets, +/// UpdateExternallyDefinedStaticWebAssets, ComputeReferenceStaticWebAssetItems and +/// DefineStaticWebAssets.ApplyGroupDefinitions. +/// +public class AssetGroupFilteringTest : IDisposable +{ + private readonly string _tempDir; + private readonly Mock _buildEngine; + private readonly List _errorMessages; + private readonly List _logMessages; + + public AssetGroupFilteringTest() + { + _tempDir = Path.Combine(Path.GetTempPath(), "AssetGroupTest_" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(_tempDir); + + _errorMessages = new List(); + _logMessages = new List(); + _buildEngine = new Mock(); + _buildEngine.Setup(e => e.ProjectFileOfTaskNode).Returns(Path.Combine(_tempDir, "test.csproj")); + _buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) + .Callback(args => _errorMessages.Add(args.Message)); + _buildEngine.Setup(e => e.LogMessageEvent(It.IsAny())) + .Callback(args => _logMessages.Add(args.Message)); + } + + public void Dispose() + { + if (Directory.Exists(_tempDir)) + { + try { Directory.Delete(_tempDir, recursive: true); } catch { } + } + } + + [Fact] + public void UpdateExternal_AssetWithGroups_MatchingDeclaration_IsIncluded() + { + var file = CreateTempFile("ext", "site.css", "body{}"); + var asset = CreateExternalAssetWithGroups(file, "IdentityUI", "css/site.css", "BootstrapVersion=V5"); + + var task = new UpdateExternallyDefinedStaticWebAssets + { + BuildEngine = _buildEngine.Object, + Assets = new[] { asset }, + Endpoints = Array.Empty(), + StaticWebAssetGroups = new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V5", + ["SourceId"] = "IdentityUI" + }) + } + }; + + var result = task.Execute(); + + result.Should().BeTrue(); + task.UpdatedAssets.Should().HaveCount(1); + } + + [Fact] + public void UpdateExternal_AssetWithGroups_NoDeclarations_IsExcluded() + { + var file = CreateTempFile("ext", "site.css", "body{}"); + var asset = CreateExternalAssetWithGroups(file, "IdentityUI", "css/site.css", "BootstrapVersion=V5"); + + var task = new UpdateExternallyDefinedStaticWebAssets + { + BuildEngine = _buildEngine.Object, + Assets = new[] { asset }, + Endpoints = Array.Empty(), + // No StaticWebAssetGroups + }; + + var result = task.Execute(); + + result.Should().BeTrue(); + task.UpdatedAssets.Should().HaveCount(0, "grouped assets should be excluded when no declarations exist"); + } + + [Fact] + public void UpdateExternal_MultiGroup_PartialMatch_IsExcluded() + { + var file = CreateTempFile("ext", "site.css", "body{}"); + var asset = CreateExternalAssetWithGroups(file, "IdentityUI", "css/site.css", "BootstrapVersion=V5;DebugAssets=true"); + + var task = new UpdateExternallyDefinedStaticWebAssets + { + BuildEngine = _buildEngine.Object, + Assets = new[] { asset }, + Endpoints = Array.Empty(), + StaticWebAssetGroups = new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V5", + ["SourceId"] = "IdentityUI" + }) + } + }; + + var result = task.Execute(); + + result.Should().BeTrue(); + task.UpdatedAssets.Should().HaveCount(0, "AND-matching requires all entries satisfied"); + } + + [Fact] + public void UpdateExternal_CascadingExclusion_RelatedAssetExcludedWithPrimary() + { + var primaryFile = CreateTempFile("ext", "css", "site.css", "body{}"); + var relatedFile = CreateTempFile("ext", "css", "site.css.gz", "compressed"); + + var primary = CreateExternalAssetWithGroups(primaryFile, "IdentityUI", "css/site.css", "BootstrapVersion=V5"); + var related = CreateExternalAsset(relatedFile, "IdentityUI", "css/site.css.gz"); + related.SetMetadata("AssetRole", "Alternative"); + related.SetMetadata("AssetTraitName", "Content-Encoding"); + related.SetMetadata("AssetTraitValue", "gzip"); + related.SetMetadata("RelatedAsset", Path.GetFullPath(primaryFile)); + + var task = new UpdateExternallyDefinedStaticWebAssets + { + BuildEngine = _buildEngine.Object, + Assets = new[] { primary, related }, + Endpoints = Array.Empty(), + // No declarations → primary excluded → related cascades + }; + + var result = task.Execute(); + + result.Should().BeTrue(); + task.UpdatedAssets.Should().HaveCount(0, "related asset should cascade-exclude with primary"); + } + + [Fact] + public void UpdateExternal_EndpointFiltering_ExcludedAssetEndpointsRemoved() + { + var includedFile = CreateTempFile("ext", "app.js", "var x;"); + var excludedFile = CreateTempFile("ext2", "site.css", "body{}"); + + var includedAsset = CreateExternalAsset(includedFile, "SomeLib", "app.js"); + var excludedAsset = CreateExternalAssetWithGroups(excludedFile, "IdentityUI", "css/site.css", "BootstrapVersion=V5"); + + var includedEndpoint = new TaskItem("app.js", new Dictionary + { + ["AssetFile"] = Path.GetFullPath(includedFile), + ["Route"] = "app.js", + ["Selectors"] = "[]", + ["EndpointProperties"] = "[]", + ["ResponseHeaders"] = "[]", + }); + var excludedEndpoint = new TaskItem("css/site.css", new Dictionary + { + ["AssetFile"] = Path.GetFullPath(excludedFile), + ["Route"] = "css/site.css", + ["Selectors"] = "[]", + ["EndpointProperties"] = "[]", + ["ResponseHeaders"] = "[]", + }); + + var task = new UpdateExternallyDefinedStaticWebAssets + { + BuildEngine = _buildEngine.Object, + Assets = new[] { includedAsset, excludedAsset }, + Endpoints = new[] { includedEndpoint, excludedEndpoint }, + // No declarations → grouped asset excluded + }; + + var result = task.Execute(); + + result.Should().BeTrue(); + task.UpdatedEndpoints.Should().HaveCount(1, "only endpoints for included assets should remain"); + } + + [Fact] + public void ComputeReference_GroupedFrameworkAsset_PreservesSourceType() + { + // Two grouped framework assets at the same target path + var asset1 = CreateReferenceAsset("item1.css", "FrameworkLib", "Framework", "css/site.css", "All", "All", "BootstrapVersion=V4"); + var asset2 = CreateReferenceAsset("item2.css", "FrameworkLib", "Framework", "css/site.css", "All", "All", "BootstrapVersion=V5"); + + var task = new ComputeReferenceStaticWebAssetItems + { + BuildEngine = _buildEngine.Object, + Source = "FrameworkLib", + Assets = new[] { asset1, asset2 }, + Patterns = Array.Empty(), + AssetKind = "Build", + ProjectMode = "Default", + UpdateSourceType = true + }; + + var result = task.Execute(); + + result.Should().BeTrue(); + // Both should be included (distinct groups) + task.StaticWebAssets.Should().HaveCount(2); + // And both should STILL be Framework, not overwritten to Project + foreach (var asset in task.StaticWebAssets) + { + asset.GetMetadata("SourceType").Should().Be("Framework", + "grouped framework assets should preserve SourceType=Framework"); + } + } + + [Fact] + public void ComputeReference_NonGroupedFrameworkAsset_PreservesSourceType() + { + var asset = CreateReferenceAsset("framework.js", "FrameworkLib", "Framework", "js/framework.js", "All", "All"); + + var task = new ComputeReferenceStaticWebAssetItems + { + BuildEngine = _buildEngine.Object, + Source = "FrameworkLib", + Assets = new[] { asset }, + Patterns = Array.Empty(), + AssetKind = "Build", + ProjectMode = "Default", + UpdateSourceType = true + }; + + var result = task.Execute(); + + result.Should().BeTrue(); + task.StaticWebAssets.Should().HaveCount(1); + task.StaticWebAssets[0].GetMetadata("SourceType").Should().Be("Framework", + "non-grouped framework assets should also preserve SourceType=Framework"); + } + + [Fact] + public void ApplyGroupDefinitions_SameOrderSameSourceId_ProducesError() + { + var file = CreateTempFile("wwwroot", "V5", "css", "site.css", "body{}"); + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V5", + ["Order"] = "0", + ["SourceId"] = "IdentityUI", + ["IncludePattern"] = "V5/**", + ["RelativePathPattern"] = "V5/**" + }), + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "0", + ["SourceId"] = "IdentityUI", + ["IncludePattern"] = "V4/**", + ["RelativePathPattern"] = "V4/**" + }) + }, + sourceId: "MyProject", + basePath: "_content/myproject"); + + var result = task.Execute(); + + result.Should().BeFalse("same Order + same SourceId should produce an error"); + _errorMessages.Should().ContainMatch("*same Order*"); + } + + [Fact] + public void ApplyGroupDefinitions_DifferentOrderSameSourceId_NoError() + { + var file = CreateTempFile("wwwroot", "V5", "css", "site.css", "body{}"); + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V5", + ["Order"] = "0", + ["SourceId"] = "IdentityUI", + ["IncludePattern"] = "V5/**", + ["RelativePathPattern"] = "V5/**" + }), + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "1", + ["SourceId"] = "IdentityUI", + ["IncludePattern"] = "V4/**", + ["RelativePathPattern"] = "V4/**" + }) + }, + sourceId: "MyProject", + basePath: "_content/myproject"); + + var result = task.Execute(); + + result.Should().BeTrue("different Orders should not trigger the same-Order-same-SourceId validation"); + _errorMessages.Should().BeEmpty(); + } + + [Theory] + [InlineData(new[] { "BootstrapVersion=V4", "BootstrapVersion=V5" }, true)] + [InlineData(new[] { "BootstrapVersion=V4", "" }, false)] + [InlineData(new[] { "BootstrapVersion=V5", "BootstrapVersion=V5" }, false)] + public void AllAssetsHaveDistinctGroups_ReturnsExpectedResult(string[] groups, bool expected) + { + var assets = groups.Select((g, i) => CreateStaticWebAsset($"{(char)('a' + i)}.css", g)).ToList(); + var groupSet = new HashSet(StringComparer.Ordinal); + StaticWebAsset.AllAssetsHaveDistinctGroups(assets, groupSet).Should().Be(expected); + } + + private string CreateTempFile(params string[] pathParts) + { + var content = pathParts[^1]; + var segments = pathParts[..^1]; + + var dir = Path.Combine(new[] { _tempDir }.Concat(segments[..^1]).ToArray()); + Directory.CreateDirectory(dir); + var filePath = Path.Combine(dir, segments[^1]); + File.WriteAllText(filePath, content); + return filePath; + } + + private ITaskItem CreateExternalAsset(string filePath, string sourceId, string relativePath) + { + var contentRoot = Path.GetDirectoryName(filePath) + Path.DirectorySeparatorChar; + return new TaskItem(filePath, new Dictionary + { + ["SourceType"] = "Discovered", + ["SourceId"] = sourceId, + ["ContentRoot"] = contentRoot, + ["BasePath"] = "", + ["RelativePath"] = relativePath, + ["AssetKind"] = "All", + ["AssetMode"] = "All", + ["AssetRole"] = "Primary", + ["RelatedAsset"] = "", + ["AssetTraitName"] = "", + ["AssetTraitValue"] = "", + ["CopyToOutputDirectory"] = "PreserveNewest", + ["CopyToPublishDirectory"] = "PreserveNewest", + ["OriginalItemSpec"] = filePath, + }); + } + + private ITaskItem CreateExternalAssetWithGroups(string filePath, string sourceId, string relativePath, string assetGroups) + { + var item = CreateExternalAsset(filePath, sourceId, relativePath); + item.SetMetadata("AssetGroups", assetGroups); + return item; + } + + private static ITaskItem CreateReferenceAsset( + string itemSpec, + string sourceId, + string sourceType, + string relativePath, + string assetKind, + string assetMode, + string assetGroups = null) + { + var result = new StaticWebAsset() + { + Identity = Path.GetFullPath(itemSpec), + SourceId = sourceId, + SourceType = sourceType, + ContentRoot = Directory.GetCurrentDirectory(), + BasePath = "base", + RelativePath = relativePath, + AssetKind = assetKind, + AssetMode = assetMode, + AssetRole = "Primary", + RelatedAsset = "", + AssetTraitName = "", + AssetTraitValue = "", + CopyToOutputDirectory = "", + CopyToPublishDirectory = "", + OriginalItemSpec = itemSpec, + Integrity = "integrity", + Fingerprint = "fingerprint", + FileLength = 10, + LastWriteTime = DateTime.UtcNow, + }; + + if (!string.IsNullOrEmpty(assetGroups)) + { + result.AssetGroups = assetGroups; + } + + result.ApplyDefaults(); + result.Normalize(); + + return result.ToTaskItem(); + } + + private static StaticWebAsset CreateStaticWebAsset(string identity, string assetGroups) + { + var asset = new StaticWebAsset + { + Identity = Path.GetFullPath(identity), + SourceId = "TestLib", + SourceType = "Package", + ContentRoot = Directory.GetCurrentDirectory(), + BasePath = "base", + RelativePath = identity, + AssetKind = "All", + AssetMode = "All", + AssetRole = "Primary", + RelatedAsset = "", + AssetTraitName = "", + AssetTraitValue = "", + CopyToOutputDirectory = "", + CopyToPublishDirectory = "", + OriginalItemSpec = identity, + Integrity = "integrity", + Fingerprint = "fingerprint", + FileLength = 10, + LastWriteTime = DateTime.UtcNow, + AssetGroups = assetGroups, + }; + + asset.ApplyDefaults(); + asset.Normalize(); + return asset; + } + + private ITaskItem CreateCandidateAssetItem(string file, string integrity = "integrity", string fingerprint = "fingerprint", string fileLength = "10") + { + return new TaskItem(file, new Dictionary + { + ["RelativePath"] = "", + ["TargetPath"] = "", + ["Link"] = "", + ["CopyToOutputDirectory"] = "", + ["CopyToPublishDirectory"] = "", + ["Integrity"] = integrity, + ["Fingerprint"] = fingerprint, + ["LastWriteTime"] = DateTime.UtcNow.ToString(StaticWebAsset.DateTimeAssetFormat), + ["FileLength"] = fileLength, + }); + } + + private DefineStaticWebAssets CreateDefineStaticWebAssetsTask( + ITaskItem[] candidates, + ITaskItem[] groupDefs, + string sourceId = "IdentityUI", + string contentRoot = null, + string basePath = "Identity") + { + return new DefineStaticWebAssets + { + BuildEngine = _buildEngine.Object, + TestResolveFileDetails = (_, _) => (null, 10, new DateTimeOffset(2023, 10, 1, 0, 0, 0, TimeSpan.Zero)), + CandidateAssets = candidates, + RelativePathPattern = "wwwroot/**", + SourceType = "Discovered", + SourceId = sourceId, + ContentRoot = contentRoot ?? Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar, + BasePath = basePath, + StaticWebAssetGroupDefinitions = groupDefs + }; + } + + [Fact] + public void ApplyGroupDefinitions_ContentRootSuffix_AdjustsContentRoot() + { + var file = CreateTempFile("wwwroot", "V4", "css", "site.css", "body-v4{}"); + var wwwrootPath = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "0", + ["IncludePattern"] = "V4/**", + ["RelativePathPattern"] = "V4/**", + ["ContentRootSuffix"] = "V4" + }) + }); + + var result = task.Execute(); + + result.Should().BeTrue(); + _errorMessages.Should().BeEmpty(); + task.Assets.Should().HaveCount(1); + + var asset = StaticWebAsset.FromTaskItem(task.Assets[0]); + asset.RelativePath.Should().Be("css/site.css", "RelativePathPattern stripped the V4/ prefix"); + asset.ContentRoot.Should().Be(wwwrootPath + "V4" + Path.DirectorySeparatorChar, + "ContentRootSuffix appended V4 to wwwroot path"); + asset.AssetGroups.Should().Contain("BootstrapVersion=V4"); + } + + [Fact] + public void ApplyGroupDefinitions_PatternOnly_NoAutoFileOnlyToken() + { + var file = CreateTempFile("wwwroot", "V4", "css", "site.css", "body-v4{}"); + var wwwrootPath = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "0", + ["IncludePattern"] = "V4/**", + ["RelativePathPattern"] = "V4/**" + // No RelativePathPrefix, no ContentRootSuffix + }) + }); + + var result = task.Execute(); + + result.Should().BeTrue(); + _errorMessages.Should().BeEmpty(); + task.Assets.Should().HaveCount(1); + + var asset = StaticWebAsset.FromTaskItem(task.Assets[0]); + asset.RelativePath.Should().Be("css/site.css", + "RelativePathPattern stripped V4/ prefix — no auto-injection of file-only ~ token"); + asset.RelativePath.Should().NotContain("~", "SDK must not auto-inject file-only tokens"); + asset.ContentRoot.Should().Be(wwwrootPath, "ContentRoot unchanged when no ContentRootSuffix"); + } + + [Fact] + public void ApplyGroupDefinitions_RelativePathPrefix_FileOnlyToken() + { + var file = CreateTempFile("wwwroot", "V4", "css", "site.css", "body-v4{}"); + var wwwrootPath = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "0", + ["IncludePattern"] = "V4/**", + ["RelativePathPattern"] = "V4/**", + ["RelativePathPrefix"] = "#[{BootstrapVersion}/]~" + }) + }); + + var result = task.Execute(); + + result.Should().BeTrue(); + _errorMessages.Should().BeEmpty(); + task.Assets.Should().HaveCount(1); + + var asset = StaticWebAsset.FromTaskItem(task.Assets[0]); + asset.RelativePath.Should().Be("#[{BootstrapVersion}/]~css/site.css", + "pattern strips V4/, prefix prepends file-only token expression"); + asset.ContentRoot.Should().Be(wwwrootPath, "ContentRoot unchanged when no ContentRootSuffix"); + asset.AssetGroups.Should().Contain("BootstrapVersion=V4"); + } + + [Fact] + public void ApplyGroupDefinitions_RelativePathPrefix_LiteralPrepend() + { + var file = CreateTempFile("wwwroot", "V4", "css", "site.css", "body-v4{}"); + var wwwrootPath = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "0", + ["IncludePattern"] = "V4/**", + ["RelativePathPattern"] = "V4/**", + ["RelativePathPrefix"] = "shared/" + }) + }); + + var result = task.Execute(); + + result.Should().BeTrue(); + _errorMessages.Should().BeEmpty(); + task.Assets.Should().HaveCount(1); + + var asset = StaticWebAsset.FromTaskItem(task.Assets[0]); + asset.RelativePath.Should().Be("shared/css/site.css", + "pattern strips V4/, prefix prepends literal 'shared/'"); + asset.ContentRoot.Should().Be(wwwrootPath, "ContentRoot unchanged when no ContentRootSuffix"); + } + + [Fact] + public void ApplyGroupDefinitions_AllThreeOrthogonal() + { + var file = CreateTempFile("wwwroot", "V4", "css", "site.css", "body-v4{}"); + var wwwrootPath = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "0", + ["IncludePattern"] = "V4/**", + ["RelativePathPattern"] = "V4/**", + ["RelativePathPrefix"] = "shared/", + ["ContentRootSuffix"] = "V4" + }) + }); + + var result = task.Execute(); + + result.Should().BeTrue(); + _errorMessages.Should().BeEmpty(); + task.Assets.Should().HaveCount(1); + + var asset = StaticWebAsset.FromTaskItem(task.Assets[0]); + asset.RelativePath.Should().Be("shared/css/site.css", + "pattern strips V4/, prefix prepends 'shared/'"); + asset.ContentRoot.Should().Be(wwwrootPath + "V4" + Path.DirectorySeparatorChar, + "ContentRootSuffix applied independently"); + asset.AssetGroups.Should().Contain("BootstrapVersion=V4"); + } + + [Fact] + public void ApplyGroupDefinitions_RelativePathPrefix_WithoutPattern_PrependsToOriginalPath() + { + var file = CreateTempFile("wwwroot", "css", "site.css", "body{}"); + var wwwrootPath = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("Theme", new Dictionary + { + ["Value"] = "Default", + ["Order"] = "0", + ["IncludePattern"] = "**", + ["RelativePathPrefix"] = "lib/" + // No RelativePathPattern — no stripping, just prepend + }) + }, + sourceId: "MyLib", + basePath: "mylib"); + + var result = task.Execute(); + + result.Should().BeTrue(); + _errorMessages.Should().BeEmpty(); + task.Assets.Should().HaveCount(1); + + var asset = StaticWebAsset.FromTaskItem(task.Assets[0]); + asset.RelativePath.Should().Be("lib/css/site.css", + "no pattern stripping, but prefix 'lib/' prepended to original path"); + asset.AssetGroups.Should().Contain("Theme=Default"); + } + + [Fact] + public void ApplyGroupDefinitions_ContentRootSuffix_MultipleGroups_EachGetsOwnContentRoot() + { + var fileV4 = CreateTempFile("wwwroot", "V4", "css", "site.css", "body-v4{}"); + var fileV5 = CreateTempFile("wwwroot", "V5", "css", "site.css", "body-v5{}"); + var wwwrootPath = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var task = CreateDefineStaticWebAssetsTask( + new[] + { + CreateCandidateAssetItem(fileV4, integrity: "integrity-v4", fingerprint: "fingerprint-v4"), + CreateCandidateAssetItem(fileV5, integrity: "integrity-v5", fingerprint: "fingerprint-v5", fileLength: "11") + }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V5", + ["Order"] = "0", + ["IncludePattern"] = "V5/**", + ["RelativePathPattern"] = "V5/**", + ["ContentRootSuffix"] = "V5" + }), + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "1", + ["IncludePattern"] = "V4/**", + ["RelativePathPattern"] = "V4/**", + ["ContentRootSuffix"] = "V4" + }) + }); + + var result = task.Execute(); + + result.Should().BeTrue(); + _errorMessages.Should().BeEmpty(); + task.Assets.Should().HaveCount(2); + + var assets = task.Assets.Select(a => StaticWebAsset.FromTaskItem(a)).ToList(); + var v4Asset = assets.Single(a => a.AssetGroups.Contains("BootstrapVersion=V4")); + var v5Asset = assets.Single(a => a.AssetGroups.Contains("BootstrapVersion=V5")); + + v4Asset.ContentRoot.Should().Be(wwwrootPath + "V4" + Path.DirectorySeparatorChar, + "V4 asset gets its own ContentRoot with V4 suffix"); + v4Asset.RelativePath.Should().Be("css/site.css"); + + v5Asset.ContentRoot.Should().Be(wwwrootPath + "V5" + Path.DirectorySeparatorChar, + "V5 asset gets its own ContentRoot with V5 suffix"); + v5Asset.RelativePath.Should().Be("css/site.css"); + } +} diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/FilterStaticWebAssetGroupsTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/FilterStaticWebAssetGroupsTest.cs new file mode 100644 index 000000000000..41fdd539909e --- /dev/null +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/FilterStaticWebAssetGroupsTest.cs @@ -0,0 +1,290 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Moq; + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +public class FilterStaticWebAssetGroupsTest : IDisposable +{ + private readonly string _tempDir; + private readonly Mock _buildEngine; + private readonly List _errorMessages; + private readonly List _logMessages; + + public FilterStaticWebAssetGroupsTest() + { + _tempDir = Path.Combine(Path.GetTempPath(), "FilterGroups_" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(_tempDir); + + _errorMessages = new List(); + _logMessages = new List(); + _buildEngine = new Mock(); + _buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) + .Callback(args => _errorMessages.Add(args.Message)); + _buildEngine.Setup(e => e.LogMessageEvent(It.IsAny())) + .Callback(args => _logMessages.Add(args.Message)); + } + + public void Dispose() + { + if (Directory.Exists(_tempDir)) + { + try { Directory.Delete(_tempDir, recursive: true); } catch { } + } + } + + [Fact] + public void ConcreteGroupSatisfied_AssetIncluded() + { + var asset1 = CreateAssetItem("app.js", "MyLib", ""); + var asset2 = CreateAssetItem("site.css", "MyLib", "BootstrapVersion=V5"); + + var endpoint1 = CreateEndpointItem("app.js", asset1.ItemSpec); + var endpoint2 = CreateEndpointItem("site.css", asset2.ItemSpec); + + var (task, result) = ExecuteFilterTask( + new[] { asset1, asset2 }, + new[] { endpoint1, endpoint2 }, + new[] { CreateGroup("BootstrapVersion", "V5", "MyLib") }); + + result.Should().BeTrue(); + task.FilteredAssets.Should().HaveCount(2, "all assets should pass through when groups are satisfied"); + task.SurvivingEndpoints.Should().HaveCount(2); + } + + [Fact] + public void ConcreteGroupUnsatisfied_AssetExcluded() + { + var asset = CreateAssetItem("server.js", "MyLib", "ServerRendering=true"); + var endpoint = CreateEndpointItem("server.js", asset.ItemSpec); + + var (task, result) = ExecuteFilterTask( + new[] { asset }, + new[] { endpoint }, + new[] { CreateGroup("ServerRendering", "false", "MyLib") }); // Value doesn't match + + result.Should().BeTrue(); + task.FilteredAssets.Where(a => a != null).Should().HaveCount(0, "asset with unsatisfied group should be excluded"); + task.SurvivingEndpoints.Should().HaveCount(0, "endpoint for excluded asset should be removed"); + } + + [Fact] + public void DeferredGroupInFinalPass_Errors() + { + var asset = CreateAssetItem("server.js", "MyLib", "ServerRendering=true"); + var endpoint = CreateEndpointItem("server.js", asset.ItemSpec); + + // SkipDeferred defaults to false (final pass) + var (_, result) = ExecuteFilterTask( + new[] { asset }, + new[] { endpoint }, + new[] { CreateGroup("ServerRendering", "true", "MyLib", deferred: true) }); + + result.Should().BeFalse("deferred groups in the final pass should produce an error"); + _errorMessages.Should().ContainSingle() + .Which.Should().Contain("Deferred"); + } + + [Fact] + public void SkipDeferred_DeferredGroupsSkipped_AssetPassesThrough() + { + var asset = CreateAssetItem("server.js", "MyLib", "ServerRendering=true"); + var endpoint = CreateEndpointItem("server.js", asset.ItemSpec); + + var (task, result) = ExecuteFilterTask( + new[] { asset }, + new[] { endpoint }, + new[] { CreateGroup("ServerRendering", "false", "MyLib", deferred: true) }, // Would fail if evaluated + skipDeferred: true); + + result.Should().BeTrue(); + task.FilteredAssets.Should().HaveCount(1, "deferred groups should be skipped during pre-filter"); + task.SurvivingEndpoints.Should().HaveCount(1); + } + + [Fact] + public void CascadingExclusion_RelatedAssetsExcludedWithPrimary() + { + var primary = CreateAssetItem("server.js", "MyLib", "ServerRendering=true"); + var related = CreateRelatedAssetItem("server.js.gz", "server.js.gz", "MyLib", primary); + + var primaryEndpoint = CreateEndpointItem("server.js", primary.ItemSpec); + var relatedEndpoint = CreateEndpointItem("server.js.gz", related.ItemSpec); + + var (task, result) = ExecuteFilterTask( + new[] { primary, related }, + new[] { primaryEndpoint, relatedEndpoint }, + new[] { CreateGroup("ServerRendering", "false", "MyLib") }); // Not satisfied + + result.Should().BeTrue(); + task.FilteredAssets.Where(a => a != null).Should().HaveCount(0, "both primary and related should be excluded via cascading"); + task.SurvivingEndpoints.Should().HaveCount(0, "endpoints for both excluded assets should be removed"); + } + + [Fact] + public void EndpointsFiltered_ForExcludedAssets() + { + var includedAsset = CreateAssetItem("app.js", "MyLib", ""); + var excludedAsset = CreateAssetItem("server.js", "MyLib", "ServerRendering=true"); + + var includedEndpoint = CreateEndpointItem("app.js", includedAsset.ItemSpec); + var excludedEndpoint = CreateEndpointItem("server.js", excludedAsset.ItemSpec); + + var (task, result) = ExecuteFilterTask( + new[] { includedAsset, excludedAsset }, + new[] { includedEndpoint, excludedEndpoint }, + new[] { CreateGroup("ServerRendering", "false", "MyLib") }); + + result.Should().BeTrue(); + var nonNullAssets = task.FilteredAssets.Where(a => a != null).ToArray(); + nonNullAssets.Should().HaveCount(1); + nonNullAssets[0].ItemSpec.Should().Be(includedAsset.ItemSpec); + task.SurvivingEndpoints.Should().HaveCount(1); + task.SurvivingEndpoints[0].ItemSpec.Should().Be("app.js"); + } + + [Fact] + public void SkipDeferred_NonDeferredGroupsStillEvaluated() + { + // An asset has both a non-deferred group requirement and a deferred group requirement. + // In SkipDeferred mode, only the non-deferred group is evaluated. + var asset = CreateAssetItem("site.css", "MyLib", "BootstrapVersion=V5;ServerRendering=true"); + + var endpoint = CreateEndpointItem("site.css", asset.ItemSpec); + + var (task, result) = ExecuteFilterTask( + new[] { asset }, + new[] { endpoint }, + new[] + { + CreateGroup("BootstrapVersion", "V5", "MyLib"), + CreateGroup("ServerRendering", "true", "MyLib", deferred: true) + }, + skipDeferred: true); + + result.Should().BeTrue(); + task.FilteredAssets.Should().HaveCount(1, + "non-deferred BootstrapVersion is satisfied; deferred ServerRendering is skipped"); + } + + [Fact] + public void NullStaticWebAssetGroups_PassesThrough() + { + var asset = CreateAssetItem("app.js", "MyLib", ""); + var endpoint = CreateEndpointItem("app.js", asset.ItemSpec); + + var (task, result) = ExecuteFilterTask( + new[] { asset }, + new[] { endpoint }); + + result.Should().BeTrue(); + task.FilteredAssets.Should().HaveCount(1); + task.SurvivingEndpoints.Should().HaveCount(1); + } + + private static ITaskItem CreateGroup(string name, string value, string sourceId, bool deferred = false) + { + var dict = new Dictionary + { + ["Value"] = value, + ["SourceId"] = sourceId, + }; + if (deferred) + dict["Deferred"] = "true"; + return new TaskItem(name, dict); + } + + private (FilterStaticWebAssetGroups Task, bool Result) ExecuteFilterTask( + ITaskItem[] assets, + ITaskItem[] endpoints, + ITaskItem[] groups = null, + bool skipDeferred = false) + { + var task = new FilterStaticWebAssetGroups + { + BuildEngine = _buildEngine.Object, + Assets = assets, + Endpoints = endpoints, + SkipDeferred = skipDeferred, + StaticWebAssetGroups = groups, + }; + var result = task.Execute(); + return (task, result); + } + + private ITaskItem CreateRelatedAssetItem(string fileName, string relativePath, string sourceId, ITaskItem primaryAsset, string traitName = "Content-Encoding", string traitValue = "gzip") + { + var filePath = Path.Combine(_tempDir, fileName); + if (!File.Exists(filePath)) + { + File.WriteAllText(filePath, "content-" + fileName); + } + + return new TaskItem(filePath, new Dictionary + { + ["SourceType"] = "Package", + ["SourceId"] = sourceId, + ["ContentRoot"] = _tempDir + Path.DirectorySeparatorChar, + ["BasePath"] = "_content/" + sourceId.ToLowerInvariant(), + ["RelativePath"] = relativePath, + ["AssetKind"] = "All", + ["AssetMode"] = "All", + ["AssetRole"] = "Alternative", + ["RelatedAsset"] = primaryAsset.ItemSpec, + ["AssetTraitName"] = traitName, + ["AssetTraitValue"] = traitValue, + ["AssetGroups"] = "", + ["Fingerprint"] = "test", + ["Integrity"] = "sha256-test", + ["CopyToOutputDirectory"] = "Never", + ["CopyToPublishDirectory"] = "PreserveNewest", + ["OriginalItemSpec"] = filePath, + }); + } + + private ITaskItem CreateAssetItem(string fileName, string sourceId, string assetGroups) + { + var filePath = Path.Combine(_tempDir, fileName); + if (!File.Exists(filePath)) + { + File.WriteAllText(filePath, "content-" + fileName); + } + + return new TaskItem(filePath, new Dictionary + { + ["SourceType"] = "Package", + ["SourceId"] = sourceId, + ["ContentRoot"] = _tempDir + Path.DirectorySeparatorChar, + ["BasePath"] = "_content/" + sourceId.ToLowerInvariant(), + ["RelativePath"] = fileName, + ["AssetKind"] = "All", + ["AssetMode"] = "All", + ["AssetRole"] = "Primary", + ["RelatedAsset"] = "", + ["AssetTraitName"] = "", + ["AssetTraitValue"] = "", + ["AssetGroups"] = assetGroups, + ["Fingerprint"] = "test", + ["Integrity"] = "sha256-test", + ["CopyToOutputDirectory"] = "Never", + ["CopyToPublishDirectory"] = "PreserveNewest", + ["OriginalItemSpec"] = filePath, + }); + } + + private static ITaskItem CreateEndpointItem(string route, string assetFile) + { + return new TaskItem(route, new Dictionary + { + ["AssetFile"] = assetFile, + ["Selectors"] = "[]", + ["ResponseHeaders"] = "[]", + ["EndpointProperties"] = "[]", + }); + } +} diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsManifestFileTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsManifestFileTest.cs new file mode 100644 index 000000000000..19422f019355 --- /dev/null +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsManifestFileTest.cs @@ -0,0 +1,249 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using System.Text.Json; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Moq; + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +public class GeneratePackageAssetsManifestFileTest : IDisposable +{ + private readonly string _tempDir; + private readonly Mock _buildEngine; + private readonly List _errorMessages; + + public GeneratePackageAssetsManifestFileTest() + { + _tempDir = Path.Combine(Path.GetTempPath(), "GenPkgManifest_" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(_tempDir); + + _errorMessages = new List(); + _buildEngine = new Mock(); + _buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) + .Callback(args => _errorMessages.Add(args.Message)); + _buildEngine.Setup(e => e.LogMessageEvent(It.IsAny())); + } + + public void Dispose() + { + if (Directory.Exists(_tempDir)) + { + try { Directory.Delete(_tempDir, recursive: true); } catch { } + } + } + + [Fact] + public void EmptyAssets_DoesNotGenerateManifestFile() + { + var manifestPath = Path.Combine(_tempDir, "empty.json"); + + var task = new GeneratePackageAssetsManifestFile + { + BuildEngine = _buildEngine.Object, + StaticWebAssets = Array.Empty(), + StaticWebAssetEndpoints = Array.Empty(), + TargetManifestPath = manifestPath, + }; + + var result = task.Execute(); + + result.Should().BeTrue(); + File.Exists(manifestPath).Should().BeFalse(); + } + + [Fact] + public void Assets_SerializedWithCorrectPackagePaths() + { + var file = CreateTempFile("wwwroot", "css", "site.css", "body{}"); + var contentRoot = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var asset = CreateAsset(file, contentRoot, "css/site#[.{fingerprint}]?.css", "abc123"); + + var task = CreateManifestTask(new[] { asset.ToTaskItem() }); + task.Execute().Should().BeTrue(); + var manifest = DeserializeManifest(task.TargetManifestPath); + + manifest.Assets.Should().HaveCount(1); + var manifestAsset = manifest.Assets.Values.Single(); + var packagePath = manifest.Assets.Keys.Single(); + + // Discovered assets don't include BasePath in the target path + packagePath.Should().EndWith("css/site.css"); + manifestAsset.RelativePath.Should().Be("css/site#[.{fingerprint}]?.css"); + manifestAsset.AssetRole.Should().Be("Primary"); + } + + [Fact] + public void RelatedAsset_RemappedToPackageRelativePath() + { + var primaryFile = CreateTempFile("wwwroot", "css", "site.css", "body{}"); + var relatedFile = CreateTempFile("wwwroot", "css", "site.css.gz", "compressed"); + var contentRoot = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var primary = CreateAsset(primaryFile, contentRoot, "css/site.css", "abc"); + + var related = CreateAsset(relatedFile, contentRoot, "css/site.css.gz", "def"); + related.AssetRole = "Alternative"; + related.RelatedAsset = primaryFile; + related.AssetTraitName = "Content-Encoding"; + related.AssetTraitValue = "gzip"; + + var task = CreateManifestTask( + new[] { primary.ToTaskItem(), related.ToTaskItem() }); + task.Execute().Should().BeTrue(); + var manifest = DeserializeManifest(task.TargetManifestPath); + + manifest.Assets.Should().HaveCount(2); + + var relatedAsset = manifest.Assets.Values.First(a => a.AssetRole == "Alternative"); + // The RelatedAsset should be remapped from the absolute path to a package-relative path + relatedAsset.RelatedAsset.Should().NotBe(primaryFile); + relatedAsset.RelatedAsset.Should().NotBeNullOrEmpty(); + // It should match the primary's PackagePath + var primaryAssetPath = manifest.Assets.First(kvp => kvp.Value.AssetRole == "Primary").Key; + relatedAsset.RelatedAsset.Should().Be(primaryAssetPath); + } + + [Fact] + public void Endpoints_AssetFileRemappedToPackageRelativePath() + { + var file = CreateTempFile("wwwroot", "js", "app.js", "var x;"); + var contentRoot = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var asset = CreateAsset(file, contentRoot, "js/app.js", "abc"); + + var endpoint = new StaticWebAssetEndpoint + { + Route = "_content/mylib/js/app.js", + AssetFile = file, + Selectors = [], + ResponseHeaders = [new() { Name = "Content-Type", Value = "text/javascript" }], + EndpointProperties = [], + }; + + var task = CreateManifestTask( + new[] { asset.ToTaskItem() }, + StaticWebAssetEndpoint.ToTaskItems(new[] { endpoint })); + task.Execute().Should().BeTrue(); + var manifest = DeserializeManifest(task.TargetManifestPath); + + manifest.Endpoints.Should().HaveCount(1); + var ep = manifest.Endpoints[0]; + // AssetFile should be remapped from absolute to package-relative + ep.AssetFile.Should().NotBe(file); + ep.AssetFile.Should().Be(manifest.Assets.Keys.Single()); + } + + [Fact] + public void FrameworkPattern_TagsMatchingAssetsAsFramework() + { + var fwFile = CreateTempFile("wwwroot", "js", "framework.js", "fw"); + var nonFwFile = CreateTempFile("wwwroot", "js", "app.js", "app"); + var contentRoot = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var fwAsset = CreateAsset(fwFile, contentRoot, "js/framework.js", "abc"); + var nonFwAsset = CreateAsset(nonFwFile, contentRoot, "js/app.js", "def"); + + var task = CreateManifestTask( + new[] { fwAsset.ToTaskItem(), nonFwAsset.ToTaskItem() }, + frameworkPattern: "js/framework*"); + task.Execute().Should().BeTrue(); + var manifest = DeserializeManifest(task.TargetManifestPath); + + manifest.Assets.Should().HaveCount(2); + + var fwManifestAsset = manifest.Assets.Values.First(a => a.RelativePath == "js/framework.js"); + fwManifestAsset.SourceType.Should().Be("Framework"); + + var nonFwManifestAsset = manifest.Assets.Values.First(a => a.RelativePath == "js/app.js"); + nonFwManifestAsset.SourceType.Should().Be("Package"); + } + + [Fact] + public void AssetGroups_PreservedInManifest() + { + var file = CreateTempFile("wwwroot", "css", "site.css", "body{}"); + var contentRoot = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var asset = CreateAsset(file, contentRoot, "css/site.css", "abc"); + asset.AssetGroups = "BootstrapVersion=V5"; + + var task = CreateManifestTask(new[] { asset.ToTaskItem() }); + task.Execute().Should().BeTrue(); + var manifest = DeserializeManifest(task.TargetManifestPath); + + manifest.Assets.Should().HaveCount(1); + manifest.Assets.Values.Single().AssetGroups.Should().Be("BootstrapVersion=V5"); + } + + private GeneratePackageAssetsManifestFile CreateManifestTask( + ITaskItem[] assets, + ITaskItem[] endpoints = null, + string frameworkPattern = null) + { + var task = new GeneratePackageAssetsManifestFile + { + BuildEngine = _buildEngine.Object, + StaticWebAssets = assets, + StaticWebAssetEndpoints = endpoints ?? Array.Empty(), + TargetManifestPath = Path.Combine(_tempDir, "manifest.json"), + }; + + if (frameworkPattern != null) + task.FrameworkPattern = frameworkPattern; + + return task; + } + + private static StaticWebAssetPackageManifest DeserializeManifest(string manifestPath) + { + return JsonSerializer.Deserialize( + File.ReadAllBytes(manifestPath), + StaticWebAssetsJsonSerializerContext.Default.StaticWebAssetPackageManifest); + } + + private string CreateTempFile(params string[] pathParts) + { + var content = pathParts[^1]; + var segments = pathParts[..^1]; + + var dir = Path.Combine(new[] { _tempDir }.Concat(segments[..^1]).ToArray()); + Directory.CreateDirectory(dir); + var filePath = Path.Combine(dir, segments[^1]); + File.WriteAllText(filePath, content); + return filePath; + } + + private StaticWebAsset CreateAsset(string filePath, string contentRoot, string relativePath, string fingerprint) + { + var asset = new StaticWebAsset + { + Identity = filePath, + SourceType = "Discovered", + SourceId = "MyLib", + ContentRoot = contentRoot, + BasePath = "_content/mylib", + RelativePath = relativePath, + AssetKind = "All", + AssetMode = "All", + AssetRole = "Primary", + RelatedAsset = "", + AssetTraitName = "", + AssetTraitValue = "", + CopyToOutputDirectory = "Never", + CopyToPublishDirectory = "PreserveNewest", + OriginalItemSpec = filePath, + Fingerprint = fingerprint, + Integrity = "sha256-" + fingerprint, + FileLength = 6, + LastWriteTime = DateTime.UtcNow, + }; + asset.ApplyDefaults(); + asset.Normalize(); + return asset; + } +} diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsTargetsFileTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsTargetsFileTest.cs new file mode 100644 index 000000000000..62c9d1363b72 --- /dev/null +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsTargetsFileTest.cs @@ -0,0 +1,131 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using System.Xml.Linq; +using Microsoft.Build.Framework; +using Moq; + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +public class GeneratePackageAssetsTargetsFileTest : IDisposable +{ + private readonly string _tempDir; + private readonly Mock _buildEngine; + private readonly List _errorMessages; + + public GeneratePackageAssetsTargetsFileTest() + { + _tempDir = Path.Combine(Path.GetTempPath(), "GenPkgTargets_" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(_tempDir); + + _errorMessages = new List(); + _buildEngine = new Mock(); + _buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) + .Callback(args => _errorMessages.Add(args.Message)); + _buildEngine.Setup(e => e.LogMessageEvent(It.IsAny())); + } + + public void Dispose() + { + if (Directory.Exists(_tempDir)) + { + try { Directory.Delete(_tempDir, recursive: true); } catch { } + } + } + + [Fact] + public void GeneratesValidXml_WithStaticWebAssetPackageManifestItem() + { + var task = CreateTask(); + + task.Execute().Should().BeTrue(); + File.Exists(task.TargetFilePath).Should().BeTrue(); + + var doc = XDocument.Load(task.TargetFilePath); + var root = doc.Root; + root.Should().NotBeNull(); + root.Name.LocalName.Should().Be("Project"); + + var itemGroup = root.Element("ItemGroup"); + itemGroup.Should().NotBeNull(); + + var manifestItem = itemGroup.Element("StaticWebAssetPackageManifest"); + manifestItem.Should().NotBeNull(); + + var includeAttr = manifestItem.Attribute("Include"); + includeAttr.Should().NotBeNull(); + includeAttr.Value.Should().Contain("MyLib.PackageAssets.json"); + + var sourceIdElement = manifestItem.Element("SourceId"); + sourceIdElement.Should().NotBeNull(); + sourceIdElement.Value.Should().Be("MyLib"); + + var contentRootElement = manifestItem.Element("ContentRoot"); + contentRootElement.Should().NotBeNull(); + contentRootElement.Value.Should().Contain("staticwebassets"); + + var packageRootElement = manifestItem.Element("PackageRoot"); + packageRootElement.Should().NotBeNull(); + } + + [Fact] + public void Incremental_FileNotRewritten_WhenContentUnchanged() + { + var task = CreateTask(); + + // First write + task.Execute().Should().BeTrue(); + var firstWriteTime = File.GetLastWriteTimeUtc(task.TargetFilePath); + var firstContent = File.ReadAllText(task.TargetFilePath); + + // Advance the file timestamp so we can detect if it gets rewritten + File.SetLastWriteTimeUtc(task.TargetFilePath, firstWriteTime.AddSeconds(10)); + firstWriteTime = File.GetLastWriteTimeUtc(task.TargetFilePath); + + // Second write with same inputs + var task2 = CreateTask(); + task2.Execute().Should().BeTrue(); + var secondWriteTime = File.GetLastWriteTimeUtc(task2.TargetFilePath); + var secondContent = File.ReadAllText(task2.TargetFilePath); + + // Content should be identical + secondContent.Should().Be(firstContent); + // File should not have been rewritten (timestamp preserved) + secondWriteTime.Should().Be(firstWriteTime); + } + + [Fact] + public void CustomPackagePathPrefix_ReflectedInContentRoot() + { + var task = CreateTask(packagePathPrefix: "custom/assets"); + + task.Execute().Should().BeTrue(); + var manifestItem = LoadManifestItem(task.TargetFilePath); + + manifestItem.Element("ContentRoot").Value.Should().Contain("custom"); + } + + private GeneratePackageAssetsTargetsFile CreateTask(string packagePathPrefix = null) + { + var task = new GeneratePackageAssetsTargetsFile + { + BuildEngine = _buildEngine.Object, + PackageId = "MyLib", + TargetFilePath = Path.Combine(_tempDir, "MyLib.targets"), + ManifestFileName = "MyLib.PackageAssets.json", + }; + if (packagePathPrefix != null) + { + task.PackagePathPrefix = packagePathPrefix; + } + return task; + } + + private static XElement LoadManifestItem(string targetFilePath) + { + var doc = XDocument.Load(targetFilePath); + return doc.Root.Element("ItemGroup").Element("StaticWebAssetPackageManifest"); + } +} diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadPackageAssetsManifestTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadPackageAssetsManifestTest.cs new file mode 100644 index 000000000000..cc0043199a38 --- /dev/null +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadPackageAssetsManifestTest.cs @@ -0,0 +1,440 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using System.Text.Json; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Moq; + +namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; + +public class ReadPackageAssetsManifestTest : IDisposable +{ + private readonly string _tempDir; + private readonly Mock _buildEngine; + private readonly List _errorMessages; + private readonly List _logMessages; + + public ReadPackageAssetsManifestTest() + { + _tempDir = Path.Combine(Path.GetTempPath(), "ReadPkgManifest_" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(_tempDir); + + _errorMessages = new List(); + _logMessages = new List(); + _buildEngine = new Mock(); + _buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) + .Callback(args => _errorMessages.Add(args.Message)); + _buildEngine.Setup(e => e.LogMessageEvent(It.IsAny())) + .Callback(args => _logMessages.Add(args.Message)); + _buildEngine.Setup(e => e.LogWarningEvent(It.IsAny())) + .Callback(args => _logMessages.Add(args.Message)); + } + + public void Dispose() + { + if (Directory.Exists(_tempDir)) + { + try { Directory.Delete(_tempDir, recursive: true); } catch { } + } + } + + [Fact] + public void ReadsValidManifest_EmitsAssetsAsTaskItems() + { + var packageRoot = SetupPackageRoot("MyLib", + CreateManifestAsset("staticwebassets/css/site.css", "css/site.css", "_content/mylib", "")); + + var manifestItem = CreateManifestItem(packageRoot, "MyLib"); + + var task = CreateReadManifestTask(new[] { manifestItem }); + task.Execute().Should().BeTrue(); + + task.Assets.Should().HaveCount(1); + + var emitted = task.Assets[0]; + emitted.GetMetadata("SourceType").Should().Be("Package"); + emitted.GetMetadata("SourceId").Should().Be("MyLib"); + emitted.GetMetadata("BasePath").Should().Be("_content/mylib"); + emitted.GetMetadata("RelativePath").Should().Be("css/site.css"); + emitted.GetMetadata("Fingerprint").Should().Be("test"); + } + + [Fact] + public void UngroupedAssets_AlwaysIncluded() + { + var packageRoot = SetupPackageRoot("MyLib", + CreateManifestAsset("staticwebassets/app.js", "app.js", "_content/mylib", "")); + + var manifestItem = CreateManifestItem(packageRoot, "MyLib"); + + var task = CreateReadManifestTask( + new[] { manifestItem }, + new[] { CreateGroup("SomeGroup", "SomeValue", "OtherLib") }); + task.Execute().Should().BeTrue(); + + task.Assets.Should().HaveCount(1, "ungrouped assets should always be included"); + } + + [Fact] + public void GroupedAsset_MatchingDeclaration_IsIncluded() + { + var packageRoot = SetupPackageRoot("IdentityUI", + CreateManifestAsset("staticwebassets/css/site.css", "css/site.css", "_content/id", "BootstrapVersion=V5")); + + var manifestItem = CreateManifestItem(packageRoot, "IdentityUI"); + + var task = CreateReadManifestTask( + new[] { manifestItem }, + new[] { CreateGroup("BootstrapVersion", "V5", "IdentityUI") }); + task.Execute().Should().BeTrue(); + + task.Assets.Should().HaveCount(1); + } + + [Fact] + public void GroupedAsset_NoDeclarations_IsExcluded() + { + var packageRoot = SetupPackageRoot("IdentityUI", + CreateManifestAsset("staticwebassets/css/site.css", "css/site.css", "_content/id", "BootstrapVersion=V5")); + + var manifestItem = CreateManifestItem(packageRoot, "IdentityUI"); + + // No StaticWebAssetGroups + var task = CreateReadManifestTask(new[] { manifestItem }); + task.Execute().Should().BeTrue(); + + task.Assets.Should().HaveCount(0, "grouped assets should be excluded with no declarations"); + } + + [Fact] + public void MultiGroup_PartialMatch_IsExcluded() + { + var packageRoot = SetupPackageRoot("IdentityUI", + CreateManifestAsset("staticwebassets/css/site.css", "css/site.css", "_content/id", + "BootstrapVersion=V5;DebugAssets=true")); + + var manifestItem = CreateManifestItem(packageRoot, "IdentityUI"); + + // BootstrapVersion declared but DebugAssets not declared + var task = CreateReadManifestTask( + new[] { manifestItem }, + new[] { CreateGroup("BootstrapVersion", "V5", "IdentityUI") }); + task.Execute().Should().BeTrue(); + + task.Assets.Should().HaveCount(0, "AND-matching: all group entries must be satisfied"); + } + + [Fact] + public void CascadingExclusion_RelatedAssetExcludedWithPrimary() + { + var primaryAsset = CreateManifestAsset( + "staticwebassets/css/site.css", "css/site.css", "_content/id", "BootstrapVersion=V5"); + var relatedAsset = CreateManifestAsset( + "staticwebassets/css/site.css.gz", "css/site.css.gz", "_content/id", ""); + relatedAsset.Value.AssetRole = "Alternative"; + relatedAsset.Value.AssetTraitName = "Content-Encoding"; + relatedAsset.Value.AssetTraitValue = "gzip"; + relatedAsset.Value.RelatedAsset = "staticwebassets/css/site.css"; + + var packageRoot = SetupPackageRoot("IdentityUI", primaryAsset, relatedAsset); + var manifestItem = CreateManifestItem(packageRoot, "IdentityUI"); + + // No group declarations → primary excluded + var task = CreateReadManifestTask(new[] { manifestItem }); + task.Execute().Should().BeTrue(); + + task.Assets.Should().HaveCount(0, "both primary and related should be excluded via cascading"); + } + + [Fact] + public void Endpoints_ForExcludedAssets_AreFilteredOut() + { + var includedAsset = CreateManifestAsset( + "staticwebassets/app.js", "app.js", "_content/id", ""); + var excludedAsset = CreateManifestAsset( + "staticwebassets/css/site.css", "css/site.css", "_content/id", "BootstrapVersion=V5"); + + var endpoints = new[] + { + new StaticWebAssetEndpoint + { + Route = "_content/id/app.js", + AssetFile = "staticwebassets/app.js", + Selectors = [], + ResponseHeaders = [], + EndpointProperties = [] + }, + new StaticWebAssetEndpoint + { + Route = "_content/id/css/site.css", + AssetFile = "staticwebassets/css/site.css", + Selectors = [], + ResponseHeaders = [], + EndpointProperties = [] + } + }; + + var packageRoot = SetupPackageRootWithEndpoints("IdentityUI", + new[] { includedAsset, excludedAsset }, endpoints); + var manifestItem = CreateManifestItem(packageRoot, "IdentityUI"); + + // No group declarations → grouped asset excluded + var task = CreateReadManifestTask(new[] { manifestItem }); + task.Execute().Should().BeTrue(); + + task.Assets.Should().HaveCount(1, "only ungrouped asset should be included"); + task.Endpoints.Should().HaveCount(1, "endpoint for excluded asset should be removed"); + task.Endpoints[0].ItemSpec.Should().Be("_content/id/app.js"); + } + + [Fact] + public void DeferredGroups_SkippedDuringEagerFiltering() + { + var packageRoot = SetupPackageRoot("IdentityUI", + CreateManifestAsset("staticwebassets/css/site.css", "css/site.css", "_content/id", + "ServerRendering=true")); + + var manifestItem = CreateManifestItem(packageRoot, "IdentityUI"); + + var task = CreateReadManifestTask( + new[] { manifestItem }, + new[] { CreateGroup("ServerRendering", "", "IdentityUI", deferred: true) }); + task.Execute().Should().BeTrue(); + + task.Assets.Should().HaveCount(1, + "deferred group requirements should be skipped during eager filtering"); + } + + [Fact] + public void FrameworkAssets_MaterializedToIntermediateDirectory() + { + var packageRoot = SetupPackageRoot("MyLib", + CreateManifestAsset("staticwebassets/js/framework.js", "js/framework.js", "_content/mylib", "", "Framework")); + + var manifestItem = CreateManifestItem(packageRoot, "MyLib"); + + var task = CreateReadManifestTask(new[] { manifestItem }); + task.Execute().Should().BeTrue(); + + task.Assets.Should().HaveCount(1); + + var emitted = task.Assets[0]; + // Framework assets should be materialized to the fx directory + var expectedDir = Path.Combine(_tempDir, "obj", "fx", "MyLib"); + emitted.ItemSpec.Should().StartWith(expectedDir); + File.Exists(emitted.ItemSpec).Should().BeTrue(); + + // SourceType changes to Discovered for framework materialization + emitted.GetMetadata("SourceType").Should().Be("Discovered"); + emitted.GetMetadata("SourceId").Should().Be("ConsumerApp"); + } + + [Fact] + public void InvalidManifestVersion_LogsError() + { + var packageDir = Path.Combine(_tempDir, "packages", "BadLib"); + var buildDir = Path.Combine(packageDir, "build"); + Directory.CreateDirectory(buildDir); + + // Write a staticwebassets directory with a file + var swDir = Path.Combine(packageDir, "staticwebassets"); + Directory.CreateDirectory(swDir); + + var badManifest = new { Version = 2, ManifestType = "Package", Assets = new Dictionary(), Endpoints = Array.Empty() }; + var manifestPath = Path.Combine(buildDir, "BadLib.PackageAssets.json"); + File.WriteAllText(manifestPath, JsonSerializer.Serialize(badManifest)); + + var manifestItem = new TaskItem(manifestPath, new Dictionary + { + ["SourceId"] = "BadLib", + ["ContentRoot"] = swDir + Path.DirectorySeparatorChar, + ["PackageRoot"] = packageDir, + }); + + var task = CreateReadManifestTask(new[] { manifestItem }); + var result = task.Execute(); + + result.Should().BeFalse(); + _errorMessages.Should().ContainSingle(m => m.Contains("Unsupported package manifest version")); + } + + private ReadPackageAssetsManifest CreateReadManifestTask( + ITaskItem[] manifests, + ITaskItem[] groups = null) + { + return new ReadPackageAssetsManifest + { + BuildEngine = _buildEngine.Object, + PackageManifests = manifests, + StaticWebAssetGroups = groups ?? Array.Empty(), + IntermediateOutputPath = Path.Combine(_tempDir, "obj"), + ProjectPackageId = "ConsumerApp", + ProjectBasePath = "_content/consumerapp", + }; + } + + private static ITaskItem CreateGroup(string name, string value, string sourceId, bool deferred = false) + { + var dict = new Dictionary + { + ["Value"] = value, + ["SourceId"] = sourceId, + }; + if (deferred) + dict["Deferred"] = "true"; + return new TaskItem(name, dict); + } + + private string SetupPackageRoot(string packageId, params KeyValuePair[] assets) + { + return SetupPackageRootWithEndpoints(packageId, assets, Array.Empty()); + } + + private string SetupPackageRootWithEndpoints(string packageId, KeyValuePair[] assets, StaticWebAssetEndpoint[] endpoints) + { + var packageDir = Path.Combine(_tempDir, "packages", packageId); + var buildDir = Path.Combine(packageDir, "build"); + Directory.CreateDirectory(buildDir); + + // Create actual files for each asset and fill in SourceId/ContentRoot + // the way GeneratePackageAssetsManifestFile does (via copy constructor). + var contentRoot = Path.Combine(packageDir, "staticwebassets") + Path.DirectorySeparatorChar; + foreach (var asset in assets) + { + var filePath = Path.Combine(packageDir, asset.Key.Replace('/', Path.DirectorySeparatorChar)); + Directory.CreateDirectory(Path.GetDirectoryName(filePath)); + File.WriteAllText(filePath, "content-" + asset.Key); + + asset.Value.SourceId = packageId; + asset.Value.ContentRoot = contentRoot; + } + + var manifest = new StaticWebAssetPackageManifest + { + Version = 1, + ManifestType = "Package", + Assets = assets.ToDictionary(kvp => kvp.Key, kvp => kvp.Value, StringComparer.OrdinalIgnoreCase), + Endpoints = endpoints, + }; + + var manifestPath = Path.Combine(buildDir, packageId + ".PackageAssets.json"); + var json = JsonSerializer.SerializeToUtf8Bytes(manifest, + StaticWebAssetsJsonSerializerContext.Default.StaticWebAssetPackageManifest); + File.WriteAllBytes(manifestPath, json); + + return packageDir; + } + + private ITaskItem CreateManifestItem(string packageRoot, string sourceId) + { + var buildDir = Path.Combine(packageRoot, "build"); + var manifestPath = Path.Combine(buildDir, sourceId + ".PackageAssets.json"); + var contentRoot = Path.Combine(packageRoot, "staticwebassets") + Path.DirectorySeparatorChar; + + return new TaskItem(manifestPath, new Dictionary + { + ["SourceId"] = sourceId, + ["ContentRoot"] = contentRoot, + ["PackageRoot"] = packageRoot, + }); + } + + private static KeyValuePair CreateManifestAsset( + string packagePath, string relativePath, string basePath, string assetGroups, string sourceType = "Package") + { + var asset = new StaticWebAsset + { + Identity = packagePath, + RelativePath = relativePath, + BasePath = basePath, + SourceType = sourceType, + AssetKind = "All", + AssetMode = "All", + AssetRole = "Primary", + RelatedAsset = "", + AssetTraitName = "", + AssetTraitValue = "", + AssetGroups = assetGroups, + Fingerprint = "test", + Integrity = "sha256-test", + CopyToOutputDirectory = "Never", + CopyToPublishDirectory = "PreserveNewest", + FileLength = 6, + LastWriteTime = new DateTimeOffset(1990, 11, 15, 0, 0, 0, TimeSpan.Zero), + }; + + return new KeyValuePair(packagePath, asset); + } + + // Scenario 6: Custom .targets author override + // A package author disables the auto-generated .targets and manually provides + // their own .targets that still registers a StaticWebAssetPackageManifest item. + // The consumer's ReadPackageAssetsManifest should still work correctly. + [Fact] + public void CustomTargetsOverride_ManualManifestItem_WorksCorrectly() + { + // Setup: simulate a package that has its manifest at a custom location + // (as if the author wrote their own .targets pointing to the manifest) + var packageRoot = SetupPackageRoot("CustomLib", + CreateManifestAsset("staticwebassets/js/custom.js", "js/custom.js", "_content/customlib", ""), + CreateManifestAsset("staticwebassets/css/theme.css", "css/theme.css", "_content/customlib", "")); + + // The manifest item metadata mirrors what a hand-authored .targets would produce. + // The key difference from auto-generated: the author controls the paths. + var manifestItem = CreateManifestItem(packageRoot, "CustomLib"); + + var task = CreateReadManifestTask(new[] { manifestItem }); + task.Execute().Should().BeTrue(); + + task.Assets.Should().HaveCount(2); + + // Both assets should have the custom package's SourceId + task.Assets.Should().OnlyContain(a => a.GetMetadata("SourceId") == "CustomLib"); + // Both should resolve Identity paths under the package root + task.Assets.Should().OnlyContain(a => a.ItemSpec.StartsWith( + Path.Combine(packageRoot, "staticwebassets"))); + } + + // Scenario 7: Multiple packages contributing manifests to the same consumer + // Two packages each provide a StaticWebAssetPackageManifest item. + // Group filtering should be applied independently per SourceId. + [Fact] + public void MultiplePackages_IndependentGroupFilteringPerSourceId() + { + // Package A: has grouped assets (BootstrapVersion=V5) + var packageRootA = SetupPackageRoot("PkgA", + CreateManifestAsset("staticwebassets/css/a.css", "css/a.css", "_content/pkga", "BootstrapVersion=V5"), + CreateManifestAsset("staticwebassets/js/a.js", "js/a.js", "_content/pkga", "")); + + // Package B: has grouped assets (Theme=Dark) and ungrouped + var packageRootB = SetupPackageRoot("PkgB", + CreateManifestAsset("staticwebassets/css/b.css", "css/b.css", "_content/pkgb", "Theme=Dark"), + CreateManifestAsset("staticwebassets/js/b.js", "js/b.js", "_content/pkgb", "")); + + var manifestA = CreateManifestItem(packageRootA, "PkgA"); + var manifestB = CreateManifestItem(packageRootB, "PkgB"); + + // Consumer declares BootstrapVersion=V5 for PkgA but NOT Theme for PkgB + var task = CreateReadManifestTask( + new[] { manifestA, manifestB }, + new[] { CreateGroup("BootstrapVersion", "V5", "PkgA") }); + task.Execute().Should().BeTrue(); + + // PkgA: css/a.css included (group matched), js/a.js included (ungrouped) + // PkgB: css/b.css excluded (Theme=Dark not declared), js/b.js included (ungrouped) + task.Assets.Should().HaveCount(3); + + var assetPaths = task.Assets.Select(a => a.GetMetadata("RelativePath")).ToList(); + assetPaths.Should().Contain("css/a.css"); + assetPaths.Should().Contain("js/a.js"); + assetPaths.Should().Contain("js/b.js"); + assetPaths.Should().NotContain("css/b.css"); + + // Verify SourceIds are correct + task.Assets.Where(a => a.GetMetadata("SourceId") == "PkgA").Should().HaveCount(2); + task.Assets.Where(a => a.GetMetadata("SourceId") == "PkgB").Should().HaveCount(1); + } +} diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ResolveCompressedAssetsTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ResolveCompressedAssetsTest.cs index 358f746c3de0..f35921164312 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ResolveCompressedAssetsTest.cs +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ResolveCompressedAssetsTest.cs @@ -15,6 +15,9 @@ namespace Microsoft.NET.Sdk.StaticWebAssets.Tests; public class ResolveCompressedAssetsTest { + private readonly List _errorMessages; + private readonly Mock _buildEngine; + public string ItemSpec { get; } public string OriginalItemSpec { get; } @@ -26,33 +29,17 @@ public ResolveCompressedAssetsTest() OutputBasePath = Path.Combine(SdkTestContext.Current.TestExecutionDirectory, nameof(ResolveCompressedAssetsTest)); ItemSpec = Path.Combine(OutputBasePath, Guid.NewGuid().ToString("N") + ".tmp"); OriginalItemSpec = Path.Combine(OutputBasePath, Guid.NewGuid().ToString("N") + ".tmp"); + _errorMessages = new List(); + _buildEngine = new Mock(); + _buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) + .Callback(args => _errorMessages.Add(args.Message)); } [Fact] public void ResolvesExplicitlyProvidedAssets() { // Arrange - var errorMessages = new List(); - var buildEngine = new Mock(); - buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) - .Callback(args => errorMessages.Add(args.Message)); - - var asset = new StaticWebAsset() - { - Identity = ItemSpec, - OriginalItemSpec = OriginalItemSpec, - RelativePath = Path.GetFileName(ItemSpec), - ContentRoot = Path.GetDirectoryName(ItemSpec), - SourceType = StaticWebAsset.SourceTypes.Discovered, - SourceId = "App", - AssetKind = StaticWebAsset.AssetKinds.All, - AssetMode = StaticWebAsset.AssetModes.All, - AssetRole = StaticWebAsset.AssetRoles.Primary, - Fingerprint = "v1", - Integrity = "abc", - FileLength = 10, - LastWriteTime = DateTime.UtcNow - }.ToTaskItem(); + var asset = CreatePrimaryAsset(); var gzipExplicitAsset = new TaskItem(asset.ItemSpec, asset.CloneCustomMetadata()); var brotliExplicitAsset = new TaskItem(asset.ItemSpec, asset.CloneCustomMetadata()); @@ -60,7 +47,7 @@ public void ResolvesExplicitlyProvidedAssets() var task = new ResolveCompressedAssets() { OutputPath = OutputBasePath, - BuildEngine = buildEngine.Object, + BuildEngine = _buildEngine.Object, CandidateAssets = new[] { asset }, Formats = "gzip;brotli", ExplicitAssets = new[] { gzipExplicitAsset, brotliExplicitAsset }, @@ -79,10 +66,6 @@ public void ResolvesExplicitlyProvidedAssets() [Fact] public void InfersPreCompressedAssetsCorrectly() { - var errorMessages = new List(); - var buildEngine = new Mock(); - buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) - .Callback(args => errorMessages.Add(args.Message)); var uncompressedCandidate = new StaticWebAsset { @@ -139,7 +122,7 @@ public void InfersPreCompressedAssetsCorrectly() OutputPath = OutputBasePath, CandidateAssets = [uncompressedCandidate.ToTaskItem(), compressedCandidate.ToTaskItem()], Formats = "gzip", - BuildEngine = buildEngine.Object + BuildEngine = _buildEngine.Object }; var result = task.Execute(); @@ -152,32 +135,12 @@ public void InfersPreCompressedAssetsCorrectly() public void ResolvesAssetsMatchingIncludePattern() { // Arrange - var errorMessages = new List(); - var buildEngine = new Mock(); - buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) - .Callback(args => errorMessages.Add(args.Message)); - - var asset = new StaticWebAsset() - { - Identity = ItemSpec, - OriginalItemSpec = OriginalItemSpec, - RelativePath = Path.GetFileName(ItemSpec), - ContentRoot = Path.GetDirectoryName(ItemSpec), - SourceType = StaticWebAsset.SourceTypes.Discovered, - SourceId = "App", - AssetKind = StaticWebAsset.AssetKinds.All, - AssetMode = StaticWebAsset.AssetModes.All, - AssetRole = StaticWebAsset.AssetRoles.Primary, - Fingerprint = "v1", - Integrity = "abc", - FileLength = 10, - LastWriteTime = DateTime.UtcNow - }.ToTaskItem(); + var asset = CreatePrimaryAsset(); var task = new ResolveCompressedAssets() { OutputPath = OutputBasePath, - BuildEngine = buildEngine.Object, + BuildEngine = _buildEngine.Object, CandidateAssets = new[] { asset }, IncludePatterns = "**\\*.tmp", Formats = "gzip;brotli", @@ -197,32 +160,13 @@ public void ResolvesAssetsMatchingIncludePattern() public void ResolvesAssets_WithFingerprint_MatchingIncludePattern() { // Arrange - var errorMessages = new List(); - var buildEngine = new Mock(); - buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) - .Callback(args => errorMessages.Add(args.Message)); - - var asset = new StaticWebAsset() - { - Identity = ItemSpec, - OriginalItemSpec = OriginalItemSpec, - RelativePath = Path.GetFileNameWithoutExtension(ItemSpec)+"#[.{fingerprint}]" + Path.GetExtension(ItemSpec), - ContentRoot = Path.GetDirectoryName(ItemSpec), - SourceType = StaticWebAsset.SourceTypes.Discovered, - SourceId = "App", - AssetKind = StaticWebAsset.AssetKinds.All, - AssetMode = StaticWebAsset.AssetModes.All, - AssetRole = StaticWebAsset.AssetRoles.Primary, - Fingerprint = "v1", - Integrity = "abc", - FileLength = 10, - LastWriteTime = DateTime.UtcNow - }.ToTaskItem(); + var asset = CreatePrimaryAsset( + Path.GetFileNameWithoutExtension(ItemSpec) + "#[.{fingerprint}]" + Path.GetExtension(ItemSpec)); var task = new ResolveCompressedAssets() { OutputPath = OutputBasePath, - BuildEngine = buildEngine.Object, + BuildEngine = _buildEngine.Object, CandidateAssets = new[] { asset }, IncludePatterns = "**\\*.tmp", Formats = "gzip;brotli", @@ -254,32 +198,12 @@ public void ResolvesAssets_WithFingerprint_MatchingIncludePattern() public void ExcludesAssetsMatchingExcludePattern() { // Arrange - var errorMessages = new List(); - var buildEngine = new Mock(); - buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) - .Callback(args => errorMessages.Add(args.Message)); - - var asset = new StaticWebAsset() - { - Identity = ItemSpec, - OriginalItemSpec = OriginalItemSpec, - RelativePath = Path.GetFileName(ItemSpec), - ContentRoot = Path.GetDirectoryName(ItemSpec), - SourceType = StaticWebAsset.SourceTypes.Discovered, - SourceId = "App", - AssetKind = StaticWebAsset.AssetKinds.All, - AssetMode = StaticWebAsset.AssetModes.All, - AssetRole = StaticWebAsset.AssetRoles.Primary, - Fingerprint = "v1", - Integrity = "abc", - FileLength = 10, - LastWriteTime = DateTime.UtcNow - }.ToTaskItem(); + var asset = CreatePrimaryAsset(); var task = new ResolveCompressedAssets() { OutputPath = OutputBasePath, - BuildEngine = buildEngine.Object, + BuildEngine = _buildEngine.Object, IncludePatterns = "**\\*", ExcludePatterns = "**\\*.tmp", CandidateAssets = new[] { asset }, @@ -298,27 +222,7 @@ public void ExcludesAssetsMatchingExcludePattern() public void DeduplicatesAssetsResolvedBothExplicitlyAndFromPattern() { // Arrange - var errorMessages = new List(); - var buildEngine = new Mock(); - buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) - .Callback(args => errorMessages.Add(args.Message)); - - var asset = new StaticWebAsset() - { - Identity = ItemSpec, - OriginalItemSpec = OriginalItemSpec, - RelativePath = Path.GetFileName(ItemSpec), - ContentRoot = Path.GetDirectoryName(ItemSpec), - SourceType = StaticWebAsset.SourceTypes.Discovered, - SourceId = "App", - AssetKind = StaticWebAsset.AssetKinds.All, - AssetMode = StaticWebAsset.AssetModes.All, - AssetRole = StaticWebAsset.AssetRoles.Primary, - Fingerprint = "v1", - Integrity = "abc", - FileLength = 10, - LastWriteTime = DateTime.UtcNow - }.ToTaskItem(); + var asset = CreatePrimaryAsset(); var gzipExplicitAsset = new TaskItem(asset.ItemSpec, asset.CloneCustomMetadata()); var brotliExplicitAsset = new TaskItem(asset.ItemSpec, asset.CloneCustomMetadata()); @@ -326,7 +230,7 @@ public void DeduplicatesAssetsResolvedBothExplicitlyAndFromPattern() var buildTask = new ResolveCompressedAssets() { OutputPath = OutputBasePath, - BuildEngine = buildEngine.Object, + BuildEngine = _buildEngine.Object, CandidateAssets = new[] { asset }, IncludePatterns = "**\\*.tmp", ExplicitAssets = new[] { gzipExplicitAsset, brotliExplicitAsset }, @@ -343,61 +247,44 @@ public void DeduplicatesAssetsResolvedBothExplicitlyAndFromPattern() buildTask.AssetsToCompress[1].ItemSpec.Should().EndWith(".br"); } - [Fact] - public void IgnoresAssetsCompressedInPreviousTaskRun_Gzip() + [Theory] + [InlineData("gzip", ".gz", "brotli", ".br")] + [InlineData("brotli", ".br", "gzip", ".gz")] + public void IgnoresAssetsCompressedInPreviousTaskRun( + string phase1Format, string phase1Ext, string _, string phase2Ext) { // Arrange - var errorMessages = new List(); - var buildEngine = new Mock(); - buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) - .Callback(args => errorMessages.Add(args.Message)); - - var asset = new StaticWebAsset() - { - Identity = ItemSpec, - OriginalItemSpec = OriginalItemSpec, - RelativePath = Path.GetFileName(ItemSpec), - ContentRoot = Path.GetDirectoryName(ItemSpec), - SourceType = StaticWebAsset.SourceTypes.Discovered, - SourceId = "App", - AssetKind = StaticWebAsset.AssetKinds.All, - AssetMode = StaticWebAsset.AssetModes.All, - AssetRole = StaticWebAsset.AssetRoles.Primary, - Fingerprint = "v1", - Integrity = "abc", - FileLength = 10, - LastWriteTime = DateTime.UtcNow - }.ToTaskItem(); + var asset = CreatePrimaryAsset(); // Act/Assert var task1 = new ResolveCompressedAssets() { OutputPath = OutputBasePath, - BuildEngine = buildEngine.Object, + BuildEngine = _buildEngine.Object, CandidateAssets = new[] { asset }, IncludePatterns = "**\\*.tmp", - Formats = "gzip", + Formats = phase1Format, }; var result1 = task1.Execute(); result1.Should().BeTrue(); task1.AssetsToCompress.TakeWhile(a => a != null).Should().HaveCount(1); - task1.AssetsToCompress[0].ItemSpec.Should().EndWith(".gz"); - task1.AssetsToCompress[0].SetMetadata("Fingerprint", "v1gz"); - task1.AssetsToCompress[0].SetMetadata("Integrity", "abcgz"); + task1.AssetsToCompress[0].ItemSpec.Should().EndWith(phase1Ext); + task1.AssetsToCompress[0].SetMetadata("Fingerprint", "v1" + phase1Ext.TrimStart('.')); + task1.AssetsToCompress[0].SetMetadata("Integrity", "abc" + phase1Ext.TrimStart('.')); - var brotliExplicitAsset = new TaskItem(asset.ItemSpec, asset.CloneCustomMetadata()); - brotliExplicitAsset.SetMetadata("Fingerprint", "v2"); - brotliExplicitAsset.SetMetadata("Integrity", "def"); + var explicitAsset = new TaskItem(asset.ItemSpec, asset.CloneCustomMetadata()); + explicitAsset.SetMetadata("Fingerprint", "v2"); + explicitAsset.SetMetadata("Integrity", "def"); var task2 = new ResolveCompressedAssets() { OutputPath = OutputBasePath, - BuildEngine = buildEngine.Object, + BuildEngine = _buildEngine.Object, CandidateAssets = new[] { asset, task1.AssetsToCompress[0] }, IncludePatterns = "**\\*.tmp", - ExplicitAssets = new[] { brotliExplicitAsset }, + ExplicitAssets = new[] { explicitAsset }, Formats = "gzip;brotli" }; @@ -405,71 +292,99 @@ public void IgnoresAssetsCompressedInPreviousTaskRun_Gzip() result2.Should().BeTrue(); task2.AssetsToCompress.TakeWhile(a => a != null).Should().HaveCount(1); - task2.AssetsToCompress[0].ItemSpec.Should().EndWith(".br"); + task2.AssetsToCompress[0].ItemSpec.Should().EndWith(phase2Ext); } [Fact] - public void IgnoresAssetsCompressedInPreviousTaskRun_Brotli() + public void ProducesDistinctIdentities_ForGroupVariantsWithIdenticalContent() { - // Arrange - var errorMessages = new List(); - var buildEngine = new Mock(); - buildEngine.Setup(e => e.LogErrorEvent(It.IsAny())) - .Callback(args => errorMessages.Add(args.Message)); + // Arrange — two assets that differ only in AssetGroups but have the same + // SourceId, BasePath, AssetKind, RelativePath (after token stripping) and + // Fingerprint (identical file content). Before the fix, these would produce + // the same compressed asset Identity and crash in ToAssetDictionary. + var v4ItemSpec = Path.Combine(OutputBasePath, "staticwebassets", "V4", "css", "site.css"); + var v5ItemSpec = Path.Combine(OutputBasePath, "staticwebassets", "V5", "css", "site.css"); + + var v4Asset = new StaticWebAsset() + { + Identity = v4ItemSpec, + OriginalItemSpec = v4ItemSpec, + RelativePath = "#[{BootstrapVersion}/]~css/site#[.{fingerprint}]?.css", + ContentRoot = Path.Combine(OutputBasePath, "staticwebassets"), + SourceType = StaticWebAsset.SourceTypes.Package, + SourceId = "Microsoft.AspNetCore.Identity.UI", + BasePath = "_content/Microsoft.AspNetCore.Identity.UI", + AssetKind = StaticWebAsset.AssetKinds.All, + AssetMode = StaticWebAsset.AssetModes.All, + AssetRole = StaticWebAsset.AssetRoles.Primary, + AssetGroups = "BootstrapVersion=V4", + Fingerprint = "samehash123", + Integrity = "sameintegrity", + FileLength = 42, + LastWriteTime = DateTime.UtcNow + }.ToTaskItem(); - var asset = new StaticWebAsset() + var v5Asset = new StaticWebAsset() { - Identity = ItemSpec, - OriginalItemSpec = OriginalItemSpec, - RelativePath = Path.GetFileName(ItemSpec), - ContentRoot = Path.GetDirectoryName(ItemSpec), - SourceType = StaticWebAsset.SourceTypes.Discovered, - SourceId = "App", + Identity = v5ItemSpec, + OriginalItemSpec = v5ItemSpec, + RelativePath = "#[{BootstrapVersion}/]~css/site#[.{fingerprint}]?.css", + ContentRoot = Path.Combine(OutputBasePath, "staticwebassets"), + SourceType = StaticWebAsset.SourceTypes.Package, + SourceId = "Microsoft.AspNetCore.Identity.UI", + BasePath = "_content/Microsoft.AspNetCore.Identity.UI", AssetKind = StaticWebAsset.AssetKinds.All, AssetMode = StaticWebAsset.AssetModes.All, AssetRole = StaticWebAsset.AssetRoles.Primary, - Fingerprint = "v1", - Integrity = "abc", - FileLength = 10, + AssetGroups = "BootstrapVersion=V5", + Fingerprint = "samehash123", + Integrity = "sameintegrity", + FileLength = 42, LastWriteTime = DateTime.UtcNow }.ToTaskItem(); - // Act/Assert - var task1 = new ResolveCompressedAssets() + var task = new ResolveCompressedAssets() { OutputPath = OutputBasePath, - BuildEngine = buildEngine.Object, - CandidateAssets = new[] { asset }, - IncludePatterns = "**\\*.tmp", - Formats = "brotli", + BuildEngine = _buildEngine.Object, + CandidateAssets = new[] { v4Asset, v5Asset }, + IncludePatterns = "**/*.css", + Formats = "gzip", }; - var result1 = task1.Execute(); - - result1.Should().BeTrue(); - task1.AssetsToCompress.TakeWhile(a => a != null).Should().HaveCount(1); - task1.AssetsToCompress[0].ItemSpec.Should().EndWith(".br"); - task1.AssetsToCompress[0].SetMetadata("Fingerprint", "v1br"); - task1.AssetsToCompress[0].SetMetadata("Integrity", "abcbr"); + // Act + var result = task.Execute(); - var gzipExplicitAsset = new TaskItem(asset.ItemSpec, asset.CloneCustomMetadata()); - gzipExplicitAsset.SetMetadata("Fingerprint", "v2"); - gzipExplicitAsset.SetMetadata("Integrity", "def"); + // Assert + result.Should().BeTrue(); + var compressed = task.AssetsToCompress.TakeWhile(a => a != null).ToArray(); + compressed.Should().HaveCount(2); + compressed[0].ItemSpec.Should().EndWith(".gz"); + compressed[1].ItemSpec.Should().EndWith(".gz"); + + // The critical assertion: the two compressed assets must have different Identities + // so they don't collide when added to a dictionary keyed by Identity. + compressed[0].ItemSpec.Should().NotBe(compressed[1].ItemSpec, + "group variants with identical content must produce distinct compressed asset identities"); + } - var task2 = new ResolveCompressedAssets() + private ITaskItem CreatePrimaryAsset(string relativePath = null) + { + return new StaticWebAsset() { - OutputPath = OutputBasePath, - BuildEngine = buildEngine.Object, - CandidateAssets = new[] { asset, task1.AssetsToCompress[0] }, - IncludePatterns = "**\\*.tmp", - ExplicitAssets = new[] { gzipExplicitAsset }, - Formats = "gzip;brotli" - }; - - var result2 = task2.Execute(); - - result2.Should().BeTrue(); - task2.AssetsToCompress.TakeWhile(a => a != null).Should().HaveCount(1); - task2.AssetsToCompress[0].ItemSpec.Should().EndWith(".gz"); + Identity = ItemSpec, + OriginalItemSpec = OriginalItemSpec, + RelativePath = relativePath ?? Path.GetFileName(ItemSpec), + ContentRoot = Path.GetDirectoryName(ItemSpec), + SourceType = StaticWebAsset.SourceTypes.Discovered, + SourceId = "App", + AssetKind = StaticWebAsset.AssetKinds.All, + AssetMode = StaticWebAsset.AssetModes.All, + AssetRole = StaticWebAsset.AssetRoles.Primary, + Fingerprint = "v1", + Integrity = "abc", + FileLength = 10, + LastWriteTime = DateTime.UtcNow + }.ToTaskItem(); } } diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/StaticWebAssetTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/StaticWebAssetTest.cs index 83f5d3bb163a..faf9b7cfe8cf 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/StaticWebAssetTest.cs +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/StaticWebAssetTest.cs @@ -15,7 +15,8 @@ public void ValidateAssetGroup_SingleAsset_ReturnsTrue() var asset = CreateAsset("wwwroot/app.js", "app.js", "All", "All"); var group = (asset, (StaticWebAsset)null, (IReadOnlyList)null); - var result = StaticWebAsset.ValidateAssetGroup("app.js", group, out var reason); + var groupSet = new HashSet(StringComparer.Ordinal); + var result = StaticWebAsset.ValidateAssetGroup("app.js", group, out var reason, groupSet); Assert.True(result); Assert.Null(reason); @@ -28,7 +29,8 @@ public void ValidateAssetGroup_TwoAssetsFromDifferentProjects_ReturnsFalse() var asset2 = CreateAsset("wwwroot/app.js", "app.js", "All", "All", sourceId: "Project2"); var group = (asset1, asset2, (IReadOnlyList)null); - var result = StaticWebAsset.ValidateAssetGroup("app.js", group, out var reason); + var groupSet2 = new HashSet(StringComparer.Ordinal); + var result = StaticWebAsset.ValidateAssetGroup("app.js", group, out var reason, groupSet2); Assert.False(result); Assert.Contains("different projects", reason); @@ -41,7 +43,8 @@ public void ValidateAssetGroup_TwoAllAssetsFromSameProject_ReturnsFalse() var asset2 = CreateAsset("obj/app.js", "app.js", "All", "All"); var group = (asset1, asset2, (IReadOnlyList)null); - var result = StaticWebAsset.ValidateAssetGroup("app.js", group, out var reason); + var groupSet3 = new HashSet(StringComparer.Ordinal); + var result = StaticWebAsset.ValidateAssetGroup("app.js", group, out var reason, groupSet3); Assert.False(result); Assert.Contains("'All' assets", reason); @@ -54,7 +57,8 @@ public void ValidateAssetGroup_BuildAndPublishAssetsFromSameProject_ReturnsTrue( var publishAsset = CreateAsset("obj/app.js", "app.js", "Publish", "All"); var group = (buildAsset, publishAsset, (IReadOnlyList)null); - var result = StaticWebAsset.ValidateAssetGroup("app.js", group, out var reason); + var groupSet4 = new HashSet(StringComparer.Ordinal); + var result = StaticWebAsset.ValidateAssetGroup("app.js", group, out var reason, groupSet4); Assert.True(result); Assert.Null(reason); @@ -140,12 +144,271 @@ public void ValidateAssetGroup_DetectsConflict_WhenAssetsHaveDifferentPatterns_B computedAsset.Fingerprint = "xyz789"; var group = (discoveredAsset, computedAsset, (IReadOnlyList)null); - var result = StaticWebAsset.ValidateAssetGroup("MyApp.styles.css", group, out var reason); + var groupSet = new HashSet(StringComparer.Ordinal); + var result = StaticWebAsset.ValidateAssetGroup("MyApp.styles.css", group, out var reason, groupSet); Assert.False(result); Assert.Contains("'All' assets", reason); } + // SortByRelatedAssetInPlace tests + + [Fact] + public void SortByRelatedAssetInPlace_EmptyArray_DoesNothing() + { + var assets = Array.Empty(); + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + + Assert.Empty(assets); + } + + [Fact] + public void SortByRelatedAssetInPlace_SingleElement_DoesNothing() + { + var a = CreateChainAsset("A"); + var assets = new[] { a }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + + Assert.Same(a, assets[0]); + } + + [Fact] + public void SortByRelatedAssetInPlace_AllRoots_PreservesOrder() + { + var a = CreateChainAsset("A"); + var b = CreateChainAsset("B"); + var c = CreateChainAsset("C"); + var assets = new[] { a, b, c }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + + Assert.Same(a, assets[0]); + Assert.Same(b, assets[1]); + Assert.Same(c, assets[2]); + } + + [Fact] + public void SortByRelatedAssetInPlace_AlreadySorted_Chain() + { + // D (root) → C → B → A (parents before children) + var d = CreateChainAsset("D"); + var c = CreateChainAsset("C", relatedTo: "D"); + var b = CreateChainAsset("B", relatedTo: "C"); + var a = CreateChainAsset("A", relatedTo: "B"); + var assets = new[] { d, c, b, a }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + AssertParentsBeforeChildren(assets); + } + + [Fact] + public void SortByRelatedAssetInPlace_ReversedChain_WorstCase() + { + // Chain: A→B→C→D (D is root). Array in child-first order. + var d = CreateChainAsset("D"); + var c = CreateChainAsset("C", relatedTo: "D"); + var b = CreateChainAsset("B", relatedTo: "C"); + var a = CreateChainAsset("A", relatedTo: "B"); + var assets = new[] { a, b, c, d }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + AssertParentsBeforeChildren(assets); + } + + [Fact] + public void SortByRelatedAssetInPlace_LongReversedChain() + { + // A→B→C→D→E (E is root), worst order [A, B, C, D, E] + var e = CreateChainAsset("E"); + var d = CreateChainAsset("D", relatedTo: "E"); + var c = CreateChainAsset("C", relatedTo: "D"); + var b = CreateChainAsset("B", relatedTo: "C"); + var a = CreateChainAsset("A", relatedTo: "B"); + var assets = new[] { a, b, c, d, e }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + AssertParentsBeforeChildren(assets); + } + + [Fact] + public void SortByRelatedAssetInPlace_ShuffledChain() + { + // A→B→C→D→E (E is root), shuffled order [C, A, D, B, E] + var e = CreateChainAsset("E"); + var d = CreateChainAsset("D", relatedTo: "E"); + var c = CreateChainAsset("C", relatedTo: "D"); + var b = CreateChainAsset("B", relatedTo: "C"); + var a = CreateChainAsset("A", relatedTo: "B"); + var assets = new[] { c, a, d, b, e }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + AssertParentsBeforeChildren(assets); + } + + [Fact] + public void SortByRelatedAssetInPlace_MultipleIndependentChains() + { + // Chain 1: X→Y (Y root). Chain 2: P→Q→R (R root). + var y = CreateChainAsset("Y"); + var x = CreateChainAsset("X", relatedTo: "Y"); + var r = CreateChainAsset("R"); + var q = CreateChainAsset("Q", relatedTo: "R"); + var p = CreateChainAsset("P", relatedTo: "Q"); + // Interleave: [X, P, Q, Y, R] + var assets = new[] { x, p, q, y, r }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + AssertParentsBeforeChildren(assets); + } + + [Fact] + public void SortByRelatedAssetInPlace_Diamond_TwoChildrenOneParent() + { + // A→C, B→C, C is root. Order: [A, B, C] + var c = CreateChainAsset("C"); + var a = CreateChainAsset("A", relatedTo: "C"); + var b = CreateChainAsset("B", relatedTo: "C"); + var assets = new[] { a, b, c }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + AssertParentsBeforeChildren(assets); + } + + [Fact] + public void SortByRelatedAssetInPlace_MixedRootsAndChain() + { + // Roots: R1, R2. Chain: A→B→C (C root). Order: [A, R1, B, R2, C] + var r1 = CreateChainAsset("R1"); + var r2 = CreateChainAsset("R2"); + var c = CreateChainAsset("C"); + var b = CreateChainAsset("B", relatedTo: "C"); + var a = CreateChainAsset("A", relatedTo: "B"); + var assets = new[] { a, r1, b, r2, c }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + AssertParentsBeforeChildren(assets); + } + + [Fact] + public void SortByRelatedAssetInPlace_OrphanAsset_PlacedAnyway() + { + // A→B but B is not in the array. A should still be placed. + var a = CreateChainAsset("A", relatedTo: "NONEXISTENT"); + var r = CreateChainAsset("R"); + var assets = new[] { a, r }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + + Assert.Equal(2, assets.Length); + Assert.Contains(a, assets); + Assert.Contains(r, assets); + } + + [Fact] + public void SortByRelatedAssetInPlace_TwoElements_ChildBeforeParent() + { + var parent = CreateChainAsset("Parent"); + var child = CreateChainAsset("Child", relatedTo: "Parent"); + var assets = new[] { child, parent }; + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + + Assert.Same(parent, assets[0]); + Assert.Same(child, assets[1]); + } + + [Fact] + public void SortByRelatedAssetInPlace_ProducesValidOrder_OnVariousInputs() + { + // Verify the in-place sort produces a valid topological ordering + // for several shuffled inputs. + var e = CreateChainAsset("E"); + var d = CreateChainAsset("D", relatedTo: "E"); + var c = CreateChainAsset("C", relatedTo: "D"); + var b = CreateChainAsset("B", relatedTo: "C"); + var a = CreateChainAsset("A", relatedTo: "B"); + + var orderings = new[] + { + new[] { a, b, c, d, e }, + new[] { e, d, c, b, a }, + new[] { c, a, e, b, d }, + new[] { b, d, a, e, c }, + }; + + foreach (var order in orderings) + { + var copy = (StaticWebAsset[])order.Clone(); + StaticWebAsset.SortByRelatedAssetInPlace(copy); + AssertParentsBeforeChildren(copy); + } + } + + [Fact] + public void SortByRelatedAssetInPlace_PreservesAllElements() + { + var e = CreateChainAsset("E"); + var d = CreateChainAsset("D", relatedTo: "E"); + var c = CreateChainAsset("C", relatedTo: "D"); + var b = CreateChainAsset("B", relatedTo: "C"); + var a = CreateChainAsset("A", relatedTo: "B"); + var assets = new[] { a, b, c, d, e }; + var original = new HashSet(assets); + + StaticWebAsset.SortByRelatedAssetInPlace(assets); + + Assert.Equal(original, new HashSet(assets)); + } + + // Asserts that for every asset in the array, its RelatedAsset (parent) + // appears at an earlier index. + private static void AssertParentsBeforeChildren(StaticWebAsset[] assets) + { + var seen = new HashSet(StringComparer.OrdinalIgnoreCase); + foreach (var asset in assets) + { + if (!string.IsNullOrEmpty(asset.RelatedAsset)) + { + Assert.True( + seen.Contains(asset.RelatedAsset), + $"Asset '{Path.GetFileName(asset.Identity)}' appears before its parent '{Path.GetFileName(asset.RelatedAsset)}'"); + } + seen.Add(asset.Identity); + } + } + + private static StaticWebAsset CreateChainAsset(string name, string relatedTo = null) + { + var result = new StaticWebAsset + { + Identity = Path.GetFullPath(Path.Combine("wwwroot", name)), + SourceId = "MyProject", + SourceType = "Computed", + ContentRoot = Directory.GetCurrentDirectory(), + BasePath = "base", + RelativePath = name, + AssetKind = "All", + AssetMode = "All", + AssetRole = string.IsNullOrEmpty(relatedTo) ? "Primary" : "Related", + AssetMergeBehavior = StaticWebAsset.MergeBehaviors.PreferTarget, + AssetMergeSource = "", + RelatedAsset = relatedTo == null ? "" : Path.GetFullPath(Path.Combine("wwwroot", relatedTo)), + AssetTraitName = string.IsNullOrEmpty(relatedTo) ? "" : "Content-Encoding", + AssetTraitValue = string.IsNullOrEmpty(relatedTo) ? "" : "gzip", + CopyToOutputDirectory = "Never", + CopyToPublishDirectory = "PreserveNewest", + OriginalItemSpec = Path.Combine("wwwroot", name), + Integrity = "integrity", + Fingerprint = "fingerprint", + LastWriteTime = new DateTimeOffset(2023, 10, 1, 0, 0, 0, TimeSpan.Zero), + FileLength = 10, + }; + + return result; + } + private static StaticWebAsset CreateAsset( string itemSpec, string relativePath, From 4c68ce818e21e36154a941c5d4795918f1ffc8cf Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 14:22:24 +0100 Subject: [PATCH 04/20] Add integration tests and regenerate baselines Integration tests: - AssetGroupsIntegrationTest: build/publish with asset group selection, verifies correct assets appear in output based on selected group - DeferredAssetGroupsIntegrationTest: deferred group resolution during restore and P2P reference scenarios - FrameworkAssetsIntegrationTest: framework asset materialization from JSON manifests with group filtering - StaticWebAssetsPackIntegrationTest: pack produces JSON manifest with correct asset group metadata and .targets entry point Regenerate 32 baseline files to incorporate AssetGroups metadata and new JSON manifest packaging output. --- .../AssetGroupsIntegrationTest.cs | 204 +++++ .../DeferredAssetGroupsIntegrationTest.cs | 168 +++++ .../FrameworkAssetsIntegrationTest.cs | 149 ++-- ...sScopedCssFiles.Build.staticwebassets.json | 142 +++- ...esPublishAssets.Build.staticwebassets.json | 142 +++- ...tAndCopiesPublishAssets.Publish.files.json | 6 +- ...PublishAssets.Publish.staticwebassets.json | 272 ++++++- ...tToOutputFolder.Build.staticwebassets.json | 142 +++- ...mClassLibraries.Build.staticwebassets.json | 148 +++- ...tToOutputFolder.Build.staticwebassets.json | 142 +++- ..._NoDependencies.Build.staticwebassets.json | 142 +++- ...1ClassLibraries.Build.staticwebassets.json | 140 +++- ...esPublishAssets.Build.staticwebassets.json | 142 +++- ...tAndCopiesPublishAssets.Publish.files.json | 6 +- ...PublishAssets.Publish.staticwebassets.json | 272 ++++++- ...aryInitializers.Build.staticwebassets.json | 146 +++- ...yInitializers.Publish.staticwebassets.json | 278 ++++++- ...esPublishAssets.Build.staticwebassets.json | 142 +++- ...tAndCopiesPublishAssets.Publish.files.json | 6 +- ...PublishAssets.Publish.staticwebassets.json | 272 ++++++- ...heRightLocation.Build.staticwebassets.json | 148 +++- ...ssetsToTheRightLocation.Publish.files.json | 6 +- ...RightLocation.Publish.staticwebassets.json | 281 ++++++- ...esPublishAssets.Build.staticwebassets.json | 142 +++- ...tAndCopiesPublishAssets.Publish.files.json | 6 +- ...PublishAssets.Publish.staticwebassets.json | 272 ++++++- ...esPublishAssets.Build.staticwebassets.json | 142 +++- ...tAndCopiesPublishAssets.Publish.files.json | 6 +- ...PublishAssets.Publish.staticwebassets.json | 272 ++++++- ...1ClassLibraries.Build.staticwebassets.json | 140 +++- ...bAssetsV1ClassLibraries.Publish.files.json | 6 +- ...lassLibraries.Publish.staticwebassets.json | 269 ++++++- ...reviousVersions.Build.staticwebassets.json | 142 +++- ...le_WithPreviousVersions.Publish.files.json | 6 +- ...viousVersions.Publish.staticwebassets.json | 272 ++++++- .../StaticWebAssetsPackIntegrationTest.cs | 702 ++++-------------- 36 files changed, 4998 insertions(+), 875 deletions(-) create mode 100644 test/Microsoft.NET.Sdk.StaticWebAssets.Tests/AssetGroupsIntegrationTest.cs create mode 100644 test/Microsoft.NET.Sdk.StaticWebAssets.Tests/DeferredAssetGroupsIntegrationTest.cs diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/AssetGroupsIntegrationTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/AssetGroupsIntegrationTest.cs new file mode 100644 index 000000000000..2de1933ee3f4 --- /dev/null +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/AssetGroupsIntegrationTest.cs @@ -0,0 +1,204 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using System.IO.Compression; +using Microsoft.AspNetCore.StaticWebAssets.Tasks; + +namespace Microsoft.NET.Sdk.StaticWebAssets.Tests +{ + public class AssetGroupsIntegrationTest(ITestOutputHelper log) + : IsolatedNuGetPackageFolderAspNetSdkBaselineTest(log, nameof(AssetGroupsIntegrationTest)) + { + [Fact] + public void Pack_NupkgContains_GroupedStaticWebAssets() + { + var packagePath = PackIdentityUILib("Pack_Nupkg"); + + new FileInfo(packagePath).Should().Exist(); + + using var archive = ZipFile.OpenRead(packagePath); + var entryNames = archive.Entries.Select(e => e.FullName).ToList(); + + var expectedPatterns = new[] + { + "staticwebassets/V4/css/site.css", + "staticwebassets/V4/js/site.js", + "staticwebassets/V5/css/site.css", + "staticwebassets/V5/js/site.js", + "build/IdentityUILib.PackageAssets.json", + "build/Microsoft.AspNetCore.StaticWebAssets.targets", + "build/StaticWebAssets.Groups.targets", + "build/IdentityUILib.targets", + "buildMultiTargeting/IdentityUILib.targets", + "buildTransitive/IdentityUILib.targets", + }; + + foreach (var pattern in expectedPatterns) + { + entryNames.Should().Contain( + e => e.Replace('\\', '/').EndsWith(pattern, StringComparison.OrdinalIgnoreCase), + $"nupkg should contain entry matching '{pattern}'"); + } + } + + [Fact] + public void Pack_PropsFile_ContainsAssetGroups_Metadata() + { + var packagePath = PackIdentityUILib("Pack_Props"); + + new FileInfo(packagePath).Should().Exist(); + + using var archive = ZipFile.OpenRead(packagePath); + var manifestEntry = archive.Entries.FirstOrDefault( + e => e.FullName.Equals("build/IdentityUILib.PackageAssets.json", StringComparison.OrdinalIgnoreCase)); + + manifestEntry.Should().NotBeNull("the nupkg should contain a PackageAssets.json manifest file"); + + using var stream = manifestEntry.Open(); + using var reader = new StreamReader(stream); + var manifestContent = reader.ReadToEnd(); + + // V5 assets should carry AssetGroups metadata containing BootstrapVersion=V5 + manifestContent.Should().Contain("BootstrapVersion=V5", + "V5 assets should have AssetGroups metadata with BootstrapVersion=V5"); + + // V4 assets should carry AssetGroups metadata containing BootstrapVersion=V4 + manifestContent.Should().Contain("BootstrapVersion=V4", + "V4 assets should have AssetGroups metadata with BootstrapVersion=V4"); + } + + [Fact] + public void Build_ConsumerDefault_ExcludesGroupedAssets() + { + var manifest = BuildConsumer("Build_Default", "IdentityUIConsumer"); + + // The library's StaticWebAssets.Groups.props defaults IdentityUIFrameworkVersion=V5, + // so V5 is selected automatically and V4 is excluded. + var v4Assets = manifest.Assets + .Where(a => (a.AssetGroups ?? "").Contains("V4")) + .ToList(); + + var v5PrimaryAssets = manifest.Assets + .Where(a => (a.AssetGroups ?? "").Contains("V5") && a.AssetRole == "Primary") + .ToList(); + + v4Assets.Should().BeEmpty("V4 grouped assets should be excluded when the default selects V5"); + v5PrimaryAssets.Should().HaveCountGreaterThan(1, + "V5 should be the default group — at least css/site.css and js/site.js expected"); + } + + [Fact] + public void Build_ConsumerV4_IncludesOnlyV4Assets() + { + var manifest = BuildConsumer("Build_V4", "IdentityUIConsumerV4"); + + var includedAssets = manifest.Assets + .Where(a => (a.AssetGroups ?? "").Contains("V4") && a.AssetRole == "Primary") + .ToList(); + + includedAssets.Should().HaveCountGreaterThan(1, + "V4 assets should be included when consumer selects V4 — at least css/site.css and js/site.js"); + + var excludedAssets = manifest.Assets + .Where(a => (a.AssetGroups ?? "").Contains("V5")) + .ToList(); + + excludedAssets.Should().BeEmpty( + "V5 assets should be excluded when consumer only selects V4"); + + var includedAssetFiles = new HashSet(includedAssets.Select(a => a.Identity)); + var includedEndpoints = manifest.Endpoints + ?.Where(e => includedAssetFiles.Contains(e.AssetFile)) + .ToList(); + + includedEndpoints.Should().NotBeNull().And.HaveCountGreaterThan(1, + "endpoints should exist for V4 assets — at least one per asset"); + + includedEndpoints.Should().AllSatisfy(e => + e.Route.Should().NotContain("V4/", + "file-only segment (~) should be excluded from endpoint routes")); + } + + [Fact] + public void Build_ConsumerV5_IncludesOnlyV5Assets() + { + var manifest = BuildConsumer("Build_V5", "IdentityUIConsumerV5"); + + var includedAssets = manifest.Assets + .Where(a => (a.AssetGroups ?? "").Contains("V5") && a.AssetRole == "Primary") + .ToList(); + + includedAssets.Should().HaveCountGreaterThan(1, + "V5 assets should be included when consumer selects V5 — at least css/site.css and js/site.js"); + + var excludedAssets = manifest.Assets + .Where(a => (a.AssetGroups ?? "").Contains("V4")) + .ToList(); + + excludedAssets.Should().BeEmpty( + "V4 assets should be excluded when consumer only selects V5"); + + var includedAssetFiles = new HashSet(includedAssets.Select(a => a.Identity)); + var includedEndpoints = manifest.Endpoints + ?.Where(e => includedAssetFiles.Contains(e.AssetFile)) + .ToList(); + + includedEndpoints.Should().NotBeNull().And.HaveCountGreaterThan(1, + "endpoints should exist for V5 assets — at least one per asset"); + + includedEndpoints.Should().AllSatisfy(e => + e.Route.Should().NotContain("V5/", + "file-only segment (~) should be excluded from endpoint routes")); + } + + // Clear the cached package so NuGet re-extracts from the freshly-packed nupkg. + private void ClearCachedPackage(string packageId) + { + var cached = Path.Combine(GetNuGetCachePath(), packageId); + if (Directory.Exists(cached)) + { + Directory.Delete(cached, recursive: true); + } + } + + private string PackIdentityUILib(string identifier) + { + var testAsset = "AssetGroupsSample"; + ProjectDirectory = CreateAspNetSdkTestAsset(testAsset, identifier: identifier); + + var pack = CreatePackCommand(ProjectDirectory, "IdentityUILib"); + ExecuteCommand(pack).Should().Pass(); + + return Path.Combine( + ProjectDirectory.TestRoot, + "TestPackages", + "IdentityUILib.1.0.0.nupkg"); + } + + private StaticWebAssetsManifest BuildConsumer(string identifier, string consumerProject) + { + var testAsset = "AssetGroupsSample"; + ProjectDirectory = CreateAspNetSdkTestAsset(testAsset, identifier: identifier); + + var pack = CreatePackCommand(ProjectDirectory, "IdentityUILib"); + ExecuteCommand(pack).Should().Pass(); + ClearCachedPackage("identityuilib"); + + var restore = CreateRestoreCommand(ProjectDirectory, consumerProject); + ExecuteCommand(restore).Should().Pass(); + + var build = CreateBuildCommand(ProjectDirectory, consumerProject); + ExecuteCommand(build).Should().Pass(); + + var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); + var manifestPath = Path.Combine(intermediateOutputPath, "staticwebassets.build.json"); + new FileInfo(manifestPath).Should().Exist(); + + var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(manifestPath)); + manifest.Should().NotBeNull(); + return manifest; + } + } +} diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/DeferredAssetGroupsIntegrationTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/DeferredAssetGroupsIntegrationTest.cs new file mode 100644 index 000000000000..da5bac6dd5e9 --- /dev/null +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/DeferredAssetGroupsIntegrationTest.cs @@ -0,0 +1,168 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#nullable disable + +using System.Text.Json; +using System.Xml.Linq; +using Microsoft.AspNetCore.StaticWebAssets.Tasks; + +namespace Microsoft.NET.Sdk.StaticWebAssets.Tests +{ + public class DeferredAssetGroupsIntegrationTest(ITestOutputHelper log) : AspNetSdkTest(log) + { + [Fact] + public void Build_DeferredGroupEnabled_IncludesGroupedAssetAndEndpoints() + { + var intermediateOutputPath = BuildWithDeferredGroup(enableBlazorGroup: "enabled"); + var manifest = LoadBuildManifest(intermediateOutputPath); + var endpoints = LoadEndpointsManifest(intermediateOutputPath); + + // Primary asset should be present + var primaryAsset = manifest.Assets + .Where(a => a.RelativePath == "deferred.blazor.js" && a.AssetRole == "Primary") + .ToList(); + primaryAsset.Should().ContainSingle("deferred.blazor.js primary asset should be present when BlazorGroup=enabled"); + + // Compressed alternatives should be present + var compressedAssets = manifest.Assets + .Where(a => a.RelativePath.StartsWith("deferred.blazor.js.") && a.AssetRole == "Alternative" && a.AssetTraitName == "Content-Encoding") + .ToList(); + compressedAssets.Should().NotBeEmpty("compressed alternatives (gzip/brotli) should exist for deferred.blazor.js"); + + // Uncompressed endpoint (no selector) + var primaryEndpoints = endpoints + .Where(e => e.Route.EndsWith("deferred.blazor.js") && e.Selectors.Length == 0) + .ToList(); + primaryEndpoints.Should().ContainSingle("an uncompressed endpoint should exist for deferred.blazor.js"); + + // Compressed endpoints (with Content-Encoding selector on the same route) + var compressedEndpoints = endpoints + .Where(e => e.Route.EndsWith("deferred.blazor.js") && e.Selectors.Length == 1 && e.Selectors[0].Name == "Content-Encoding") + .ToList(); + compressedEndpoints.Should().NotBeEmpty("compressed endpoints with Content-Encoding selector should exist for deferred.blazor.js"); + + // Direct .gz/.br route endpoints + var directCompressedEndpoints = endpoints + .Where(e => e.Route.EndsWith("deferred.blazor.js.gz") || e.Route.EndsWith("deferred.blazor.js.br")) + .ToList(); + directCompressedEndpoints.Should().NotBeEmpty("direct .gz/.br route endpoints should exist for deferred.blazor.js"); + + // Existing non-grouped assets should be unaffected + var existingEndpoints = endpoints + .Where(e => e.Route.Contains("project-transitive-dep.js")) + .ToList(); + existingEndpoints.Should().NotBeEmpty("endpoints for existing non-grouped assets should be unaffected"); + } + + [Fact] + public void Build_DeferredGroupDisabled_ExcludesGroupedAssetAndEndpoints() + { + var intermediateOutputPath = BuildWithDeferredGroup(enableBlazorGroup: "disabled"); + var manifest = LoadBuildManifest(intermediateOutputPath); + var endpoints = LoadEndpointsManifest(intermediateOutputPath); + + // Build manifest retains all assets (unfiltered) — the primary asset is still there + var primaryAsset = manifest.Assets + .Where(a => a.RelativePath == "deferred.blazor.js" && a.AssetRole == "Primary") + .ToList(); + primaryAsset.Should().ContainSingle("build manifest retains all variants; deferred.blazor.js should still be present"); + + // But all deferred.blazor.js endpoints should be excluded from the endpoints manifest + var deferredEndpoints = endpoints + .Where(e => e.Route.Contains("deferred.blazor.js")) + .ToList(); + deferredEndpoints.Should().BeEmpty("no endpoints should exist for deferred.blazor.js when BlazorGroup=disabled"); + + // That includes direct .gz/.br routes + var directCompressedEndpoints = endpoints + .Where(e => e.Route.EndsWith("deferred.blazor.js.gz") || e.Route.EndsWith("deferred.blazor.js.br")) + .ToList(); + directCompressedEndpoints.Should().BeEmpty("no compressed route endpoints should exist for excluded deferred.blazor.js"); + + // Existing non-grouped assets should be unaffected + var existingEndpoints = endpoints + .Where(e => e.Route.Contains("project-transitive-dep.js")) + .ToList(); + existingEndpoints.Should().NotBeEmpty("endpoints for existing non-grouped assets should be unaffected"); + } + + private string BuildWithDeferredGroup(string enableBlazorGroup) + { + var testAsset = "RazorAppWithP2PReference"; + var projectDirectory = CreateAspNetSdkTestAsset(testAsset, identifier: enableBlazorGroup) + .WithProjectChanges((path, document) => + { + if (Path.GetFileName(path) == "ClassLibrary.csproj") + { + document.Root.Add( + new XElement("ItemGroup", + new XElement("StaticWebAssetGroupDefinition", + new XAttribute("Include", "BlazorGroup"), + new XAttribute("Value", "enabled"), + new XAttribute("Order", "0"), + new XAttribute("IncludePattern", "deferred.blazor.js")))); + document.Root.Add( + new XElement("Import", + new XAttribute("Project", "StaticWebAssets.Groups.targets"))); + } + + if (Path.GetFileName(path) == "AppWithP2PReference.csproj") + { + document.Root.Add( + new XElement("Import", + new XAttribute("Project", @"..\ClassLibrary\StaticWebAssets.Groups.targets"))); + } + }); + + var classLibDir = Path.Combine(projectDirectory.TestRoot, "ClassLibrary"); + + File.WriteAllText( + Path.Combine(classLibDir, "wwwroot", "deferred.blazor.js"), + "console.log('deferred blazor');"); + + File.WriteAllText( + Path.Combine(classLibDir, "StaticWebAssets.Groups.targets"), + $""" + + + {enableBlazorGroup} + + $(FilterDeferredStaticWebAssetGroupsDependsOn); + ResolveDeferredBlazorGroup + + + + + + + + + + + + + """); + + var build = CreateBuildCommand(projectDirectory, "AppWithP2PReference"); + ExecuteCommand(build).Should().Pass(); + + return build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); + } + + private static StaticWebAssetsManifest LoadBuildManifest(string intermediateOutputPath) + { + var path = Path.Combine(intermediateOutputPath, "staticwebassets.build.json"); + return StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(path)); + } + + private static StaticWebAssetEndpoint[] LoadEndpointsManifest(string intermediateOutputPath) + { + var path = Path.Combine(intermediateOutputPath, "staticwebassets.build.endpoints.json"); + var manifest = JsonSerializer.Deserialize( + File.ReadAllBytes(path), + StaticWebAssetsJsonSerializerContext.Default.StaticWebAssetEndpointsManifest); + return manifest?.Endpoints ?? []; + } + } +} diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/FrameworkAssetsIntegrationTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/FrameworkAssetsIntegrationTest.cs index de37f48a78fa..2c87c4b69f0e 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/FrameworkAssetsIntegrationTest.cs +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/FrameworkAssetsIntegrationTest.cs @@ -4,6 +4,7 @@ #nullable disable using System.IO.Compression; +using System.Text.Json; using Microsoft.AspNetCore.StaticWebAssets.Tasks; namespace Microsoft.NET.Sdk.StaticWebAssets.Tests @@ -27,23 +28,28 @@ public void Pack_PropsFile_ContainsFrameworkSourceType_ForMatchedAssets() new FileInfo(packagePath).Should().Exist(); - // Extract the props file from the nupkg and verify SourceType + // Extract the JSON manifest from the nupkg and verify SourceType using var archive = ZipFile.OpenRead(packagePath); - var propsEntry = archive.Entries.FirstOrDefault( - e => e.FullName.Equals("build/Microsoft.AspNetCore.StaticWebAssets.props", StringComparison.OrdinalIgnoreCase)); + var manifestEntry = archive.Entries.FirstOrDefault( + e => e.FullName.Equals("build/FrameworkAssetsLib.PackageAssets.json", StringComparison.OrdinalIgnoreCase)); - propsEntry.Should().NotBeNull("the nupkg should contain a StaticWebAssets.props file"); + manifestEntry.Should().NotBeNull("the nupkg should contain a PackageAssets.json file"); - using var stream = propsEntry.Open(); - using var reader = new StreamReader(stream); - var propsContent = reader.ReadToEnd(); + using var stream = manifestEntry.Open(); + var manifest = JsonSerializer.Deserialize(stream, + StaticWebAssetsJsonSerializerContext.Default.StaticWebAssetPackageManifest); + + manifest.Should().NotBeNull(); + manifest.Assets.Should().NotBeEmpty(); // JS files should be marked as Framework - propsContent.Should().Contain("Framework", + manifest.Assets.Values.Should().Contain( + a => a.SourceType == "Framework", "JS assets matching the FrameworkPattern should have SourceType=Framework"); // CSS files should remain as Package - propsContent.Should().Contain("Package", + manifest.Assets.Values.Should().Contain( + a => a.SourceType == "Package", "CSS assets not matching the FrameworkPattern should have SourceType=Package"); } @@ -69,45 +75,26 @@ public void Pack_NupkgContains_ExpectedStaticWebAssets() { Path.Combine("staticwebassets", "js", "framework.js"), Path.Combine("staticwebassets", "css", "site.css"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "FrameworkAssetsLib.props"), - Path.Combine("buildMultiTargeting", "FrameworkAssetsLib.props"), - Path.Combine("buildTransitive", "FrameworkAssetsLib.props"), + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "FrameworkAssetsLib.targets"), + Path.Combine("build", "FrameworkAssetsLib.PackageAssets.json"), + Path.Combine("buildMultiTargeting", "FrameworkAssetsLib.targets"), + Path.Combine("buildTransitive", "FrameworkAssetsLib.targets"), }); } [Fact] public void Build_Consumer_MaterializesFrameworkAssets() { - var testAsset = "FrameworkAssetsSample"; - ProjectDirectory = CreateAspNetSdkTestAsset(testAsset); - - // Pack the library first - var pack = CreatePackCommand(ProjectDirectory, "FrameworkAssetsLib"); - ExecuteCommand(pack).Should().Pass(); - - // Restore and build the consumer - var restore = CreateRestoreCommand(ProjectDirectory, "FrameworkAssetsConsumer"); - ExecuteCommand(restore).Should().Pass(); - - var build = CreateBuildCommand(ProjectDirectory, "FrameworkAssetsConsumer"); - ExecuteCommand(build).Should().Pass(); - - var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); - - // Verify the build manifest exists and contains our framework asset - var manifestPath = Path.Combine(intermediateOutputPath, "staticwebassets.build.json"); - new FileInfo(manifestPath).Should().Exist(); - - var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(manifestPath)); - manifest.Should().NotBeNull(); + var (intermediateOutputPath, _) = BuildFrameworkAssetsConsumer(); + var manifest = LoadBuildManifest(intermediateOutputPath); // The framework JS asset should be materialized (SourceType changed from Framework to Discovered) var frameworkAssets = manifest.Assets .Where(a => a.RelativePath.Contains("framework.js")) .ToList(); - frameworkAssets.Should().NotBeEmpty("framework.js should appear in the build manifest"); + frameworkAssets.Should().HaveCountGreaterThan(0, "framework.js should appear in the build manifest"); // After materialization, the framework asset should have SourceType=Discovered // and be under the fx/ intermediate directory @@ -124,7 +111,7 @@ public void Build_Consumer_MaterializesFrameworkAssets() .Where(a => a.RelativePath.Contains("site.css")) .ToList(); - cssAssets.Should().NotBeEmpty("site.css should appear in the build manifest"); + cssAssets.Should().HaveCountGreaterThan(0, "site.css should appear in the build manifest"); cssAssets.Should().OnlyContain(a => a.SourceType == "Package", "CSS assets should remain as Package type since they don't match the FrameworkPattern"); } @@ -132,52 +119,22 @@ public void Build_Consumer_MaterializesFrameworkAssets() [Fact] public void Build_Consumer_MaterializedFrameworkAsset_FileExistsOnDisk() { - var testAsset = "FrameworkAssetsSample"; - ProjectDirectory = CreateAspNetSdkTestAsset(testAsset); - - // Pack the library first - var pack = CreatePackCommand(ProjectDirectory, "FrameworkAssetsLib"); - ExecuteCommand(pack).Should().Pass(); - - // Restore and build the consumer - var restore = CreateRestoreCommand(ProjectDirectory, "FrameworkAssetsConsumer"); - ExecuteCommand(restore).Should().Pass(); - - var build = CreateBuildCommand(ProjectDirectory, "FrameworkAssetsConsumer"); - ExecuteCommand(build).Should().Pass(); - - var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); + var (intermediateOutputPath, _) = BuildFrameworkAssetsConsumer(); // The materialized file should exist on disk under the staticwebassets/fx directory var fxDir = Path.Combine(intermediateOutputPath, "staticwebassets", "fx", "FrameworkAssetsLib"); var materializedFile = Directory.GetFiles(fxDir, "framework.js", SearchOption.AllDirectories); materializedFile.Should().HaveCount(1, "framework.js should be materialized exactly once"); - File.ReadAllText(materializedFile[0]).Should().NotBeEmpty(); + File.ReadAllText(materializedFile[0]).Should().Contain("framework", + "materialized file should contain the original framework.js content"); } [Fact] public void Build_Consumer_EndpointsRemapped_ForFrameworkAssets() { - var testAsset = "FrameworkAssetsSample"; - ProjectDirectory = CreateAspNetSdkTestAsset(testAsset); - - // Pack the library first - var pack = CreatePackCommand(ProjectDirectory, "FrameworkAssetsLib"); - ExecuteCommand(pack).Should().Pass(); - - // Restore and build the consumer - var restore = CreateRestoreCommand(ProjectDirectory, "FrameworkAssetsConsumer"); - ExecuteCommand(restore).Should().Pass(); - - var build = CreateBuildCommand(ProjectDirectory, "FrameworkAssetsConsumer"); - ExecuteCommand(build).Should().Pass(); - - var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); - - // Read the build manifest to check endpoints - var manifestPath = Path.Combine(intermediateOutputPath, "staticwebassets.build.json"); - var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(manifestPath)); + var (intermediateOutputPath, _) = BuildFrameworkAssetsConsumer(); + var manifest = LoadBuildManifest(intermediateOutputPath); // Check that the framework asset in the manifest has been remapped to the materialized path var frameworkAssets = manifest.Assets @@ -185,7 +142,7 @@ public void Build_Consumer_EndpointsRemapped_ForFrameworkAssets() && a.Identity.Contains(Path.Combine("staticwebassets", "fx", "FrameworkAssetsLib"))) .ToList(); - frameworkAssets.Should().NotBeEmpty( + frameworkAssets.Should().HaveCountGreaterThan(0, "the manifest should contain a materialized framework asset under staticwebassets/fx/"); // Endpoints for the route should exist (some may be compressed variants) @@ -193,7 +150,7 @@ public void Build_Consumer_EndpointsRemapped_ForFrameworkAssets() ?.Where(e => e.Route.Contains("framework.js")) .ToList(); - fxEndpoints.Should().NotBeNull().And.NotBeEmpty( + fxEndpoints.Should().NotBeNull().And.HaveCountGreaterThan(0, "there should be at least one endpoint for framework.js"); // At least one endpoint should reference the materialized asset (not all will — compressed endpoints point elsewhere) @@ -201,29 +158,15 @@ public void Build_Consumer_EndpointsRemapped_ForFrameworkAssets() .Where(e => e.AssetFile.Contains(Path.Combine("staticwebassets", "fx", "FrameworkAssetsLib"))) .ToList(); - endpointsPointingToMaterialized.Should().NotBeEmpty( + endpointsPointingToMaterialized.Should().HaveCountGreaterThan(0, "at least one endpoint for framework.js should point to the materialized file path under staticwebassets/fx/"); } [Fact] public void Build_Consumer_IsIncremental() { - var testAsset = "FrameworkAssetsSample"; - ProjectDirectory = CreateAspNetSdkTestAsset(testAsset); - - // Pack the library first - var pack = CreatePackCommand(ProjectDirectory, "FrameworkAssetsLib"); - ExecuteCommand(pack).Should().Pass(); - - // Restore once - var restore = CreateRestoreCommand(ProjectDirectory, "FrameworkAssetsConsumer"); - ExecuteCommand(restore).Should().Pass(); - - // First build - var build1 = CreateBuildCommand(ProjectDirectory, "FrameworkAssetsConsumer"); - ExecuteCommand(build1).Should().Pass(); + var (intermediateOutputPath, _) = BuildFrameworkAssetsConsumer(); - var intermediateOutputPath = build1.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); var fxDir = Path.Combine(intermediateOutputPath, "staticwebassets", "fx", "FrameworkAssetsLib"); var materializedFile = Directory.GetFiles(fxDir, "framework.js", SearchOption.AllDirectories).Single(); var firstWriteTime = File.GetLastWriteTimeUtc(materializedFile); @@ -236,5 +179,31 @@ public void Build_Consumer_IsIncremental() secondWriteTime.Should().Be(firstWriteTime, "framework asset should not be re-copied on incremental build"); } + + private (string intermediateOutputPath, BuildCommand build) BuildFrameworkAssetsConsumer() + { + var testAsset = "FrameworkAssetsSample"; + ProjectDirectory = CreateAspNetSdkTestAsset(testAsset); + + var pack = CreatePackCommand(ProjectDirectory, "FrameworkAssetsLib"); + ExecuteCommand(pack).Should().Pass(); + + var restore = CreateRestoreCommand(ProjectDirectory, "FrameworkAssetsConsumer"); + ExecuteCommand(restore).Should().Pass(); + + var build = CreateBuildCommand(ProjectDirectory, "FrameworkAssetsConsumer"); + ExecuteCommand(build).Should().Pass(); + + var intermediateOutputPath = build.GetIntermediateDirectory(DefaultTfm, "Debug").ToString(); + return (intermediateOutputPath, build); + } + + private StaticWebAssetsManifest LoadBuildManifest(string intermediateOutputPath) + { + var manifestPath = Path.Combine(intermediateOutputPath, "staticwebassets.build.json"); + var manifest = StaticWebAssetsManifest.FromJsonBytes(File.ReadAllBytes(manifestPath)); + manifest.Should().NotBeNull(); + return manifest; + } } } diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_CorrectlyBundlesScopedCssFiles.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_CorrectlyBundlesScopedCssFiles.Build.staticwebassets.json index fc478292cd17..978c9c158305 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_CorrectlyBundlesScopedCssFiles.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_CorrectlyBundlesScopedCssFiles.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -162,12 +167,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -176,11 +181,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -199,6 +205,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -420,7 +436,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -975,8 +995,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1015,9 +1035,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1066,6 +1135,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json index fc478292cd17..978c9c158305 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -162,12 +167,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -176,11 +181,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -199,6 +205,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -420,7 +436,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -975,8 +995,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1015,9 +1035,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1066,6 +1135,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json index cd0e497b7792..2315be8e4b7c 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json @@ -50,9 +50,9 @@ "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.br", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.gz", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json index d468aca7322c..c126ff4a1f25 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_DeployOnBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -208,12 +215,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -222,11 +229,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -323,12 +335,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -337,11 +349,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -360,6 +373,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -567,6 +589,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -650,7 +676,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -659,6 +685,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -682,6 +709,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -705,6 +733,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -728,6 +757,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1389,8 +1419,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1429,9 +1459,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1480,6 +1559,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", @@ -1965,8 +2103,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [], "ResponseHeaders": [ { @@ -2005,9 +2143,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.br" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [ { "Name": "Content-Encoding", @@ -2056,6 +2243,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "br", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.br", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json index fc478292cd17..978c9c158305 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -162,12 +167,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -176,11 +181,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -199,6 +205,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -420,7 +436,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -975,8 +995,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1015,9 +1035,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1066,6 +1135,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_IncorporatesInitializersFromClassLibraries.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_IncorporatesInitializersFromClassLibraries.Build.staticwebassets.json index f7ff0856989e..5b0277d8f1fe 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_IncorporatesInitializersFromClassLibraries.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_IncorporatesInitializersFromClassLibraries.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\AnotherClassLib.lib.module.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSLibraryModule", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\jsmodules\\jsmodules.build.manifest.json", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -231,12 +239,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -245,11 +253,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSModuleManifest", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\ClassLibrary.lib.module.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSLibraryModule", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -558,7 +580,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -567,6 +589,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1350,8 +1376,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1390,9 +1416,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1441,6 +1516,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json index fc478292cd17..978c9c158305 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -162,12 +167,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -176,11 +181,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -199,6 +205,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -420,7 +436,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -975,8 +995,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1015,9 +1035,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1066,6 +1135,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder_NoDependencies.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder_NoDependencies.Build.staticwebassets.json index fc478292cd17..978c9c158305 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder_NoDependencies.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_NoDependencies_GeneratesJsonManifestAndCopiesItToOutputFolder_NoDependencies.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -162,12 +167,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -176,11 +181,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -199,6 +205,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -420,7 +436,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -975,8 +995,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1015,9 +1035,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1066,6 +1135,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json index c6695a55220f..345a2ff2f26d 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/BuildProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -208,12 +215,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -222,11 +229,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -374,7 +388,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1113,8 +1131,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1153,9 +1171,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1204,6 +1271,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json index 9b9bf3359696..73200f95036f 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -162,12 +167,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -176,11 +181,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -199,6 +205,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -420,7 +436,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -975,8 +995,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1015,9 +1035,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1066,6 +1135,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json index 579d21c42b1d..6a9366dd3f06 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json @@ -50,9 +50,9 @@ "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.br", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.gz", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json index e909a9e10435..8ec7a0241ca7 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_AppendTargetFrameworkToOutputPathFalse_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -208,12 +215,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -222,11 +229,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -346,12 +359,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\publish\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -360,11 +373,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -383,6 +397,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -567,6 +589,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -650,7 +676,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -659,6 +685,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -682,6 +709,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -705,6 +733,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -728,6 +757,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1389,8 +1419,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1429,9 +1459,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1480,6 +1559,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", @@ -2055,8 +2193,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [], "ResponseHeaders": [ { @@ -2095,9 +2233,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.br" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [ { "Name": "Content-Encoding", @@ -2146,6 +2333,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "br", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.br", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\publish\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitializers.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitializers.Build.staticwebassets.json index dc245d1ae862..fb7773a2dbc0 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitializers.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitializers.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\AnotherClassLib.lib.module.build.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSLibraryModule", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\jsmodules\\jsmodules.build.manifest.json", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -231,12 +239,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -245,11 +253,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSModuleManifest", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -512,7 +532,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -521,6 +541,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -567,6 +589,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1304,8 +1328,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1344,9 +1368,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1395,6 +1468,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitializers.Publish.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitializers.Publish.staticwebassets.json index d716c73c804a..750ba347c48f 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitializers.Publish.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_DifferentBuildAndPublish_LibraryInitializers.Publish.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\AnotherClassLib.lib.module.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\AnotherClassLib.lib.module.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSLibraryModule", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -277,12 +287,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -291,11 +301,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -314,6 +325,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\jsmodules\\jsmodules.publish.manifest.json", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\jsmodules\\jsmodules.publish.manifest.json", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -438,12 +455,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -452,11 +469,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -475,6 +493,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSModuleManifest", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -567,6 +589,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -659,6 +685,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -682,6 +709,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -705,6 +733,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -728,6 +757,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -751,6 +781,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -774,6 +805,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -788,7 +820,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -797,6 +829,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -820,6 +853,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -843,6 +877,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -866,6 +901,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1772,8 +1808,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1812,9 +1848,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1863,6 +1948,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", @@ -2532,8 +2676,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [], "ResponseHeaders": [ { @@ -2572,9 +2716,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.br" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [ { "Name": "Content-Encoding", @@ -2623,6 +2816,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "br", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.br", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json index fc478292cd17..978c9c158305 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -162,12 +167,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -176,11 +181,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -199,6 +205,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -420,7 +436,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -975,8 +995,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1015,9 +1035,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1066,6 +1135,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json index cd0e497b7792..2315be8e4b7c 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json @@ -50,9 +50,9 @@ "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.br", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.gz", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json index d468aca7322c..c126ff4a1f25 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -208,12 +215,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -222,11 +229,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -323,12 +335,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -337,11 +349,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -360,6 +373,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -567,6 +589,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -650,7 +676,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -659,6 +685,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -682,6 +709,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -705,6 +733,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -728,6 +757,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1389,8 +1419,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1429,9 +1459,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1480,6 +1559,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", @@ -1965,8 +2103,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [], "ResponseHeaders": [ { @@ -2005,9 +2143,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.br" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [ { "Name": "Content-Encoding", @@ -2056,6 +2243,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "br", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.br", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Build.staticwebassets.json index 0be85c759aad..4679ce3f6b46 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\AnotherClassLib.lib.module.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSLibraryModule", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\jsmodules\\jsmodules.build.manifest.json", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -231,12 +239,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -245,11 +253,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSModuleManifest", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\AnotherClassLib.lib.module.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -558,7 +580,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -567,6 +589,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1350,8 +1376,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1390,9 +1416,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1441,6 +1516,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Publish.files.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Publish.files.json index 45fd654ea97e..bb4ed6703e39 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Publish.files.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Publish.files.json @@ -71,9 +71,9 @@ "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.br", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.gz", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Publish.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Publish.staticwebassets.json index 5c32f3b5cc55..2da9d2775a6c 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Publish.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_IncorporatesInitializersFromClassLibrariesAndPublishesAssetsToTheRightLocation.Publish.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\AnotherClassLib.lib.module.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\AnotherClassLib.lib.module.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSLibraryModule", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -277,12 +287,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -291,11 +301,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -314,6 +325,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\jsmodules\\jsmodules.publish.manifest.json", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\jsmodules\\jsmodules.publish.manifest.json", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -438,12 +455,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -452,11 +469,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -475,6 +493,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "", "AssetTraitName": "JSModule", "AssetTraitValue": "JSModuleManifest", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -567,6 +589,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\AnotherClassLib.lib.module.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -659,6 +685,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -682,6 +709,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\AnotherClassLib.lib.module.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -705,6 +733,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -728,6 +757,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -751,6 +781,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -774,6 +805,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -797,6 +829,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -820,6 +853,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -843,6 +877,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -857,7 +892,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -866,6 +901,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -889,6 +925,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -912,6 +949,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -935,6 +973,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1841,8 +1880,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1881,9 +1920,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1932,6 +2020,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", @@ -2601,8 +2748,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [], "ResponseHeaders": [ { @@ -2641,9 +2788,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.br" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [ { "Name": "Content-Encoding", @@ -2692,6 +2888,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "br", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.br", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json index fc478292cd17..978c9c158305 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -162,12 +167,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -176,11 +181,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -199,6 +205,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -420,7 +436,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -975,8 +995,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1015,9 +1035,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1066,6 +1135,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json index 64a2b2273f42..481f99eb85d6 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json @@ -20,9 +20,9 @@ "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.br", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.gz", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json index d468aca7322c..c126ff4a1f25 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_NoBuild_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -208,12 +215,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -222,11 +229,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -323,12 +335,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -337,11 +349,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -360,6 +373,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -567,6 +589,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -650,7 +676,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -659,6 +685,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -682,6 +709,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -705,6 +733,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -728,6 +757,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1389,8 +1419,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1429,9 +1459,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1480,6 +1559,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", @@ -1965,8 +2103,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [], "ResponseHeaders": [ { @@ -2005,9 +2143,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.br" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [ { "Name": "Content-Encoding", @@ -2056,6 +2243,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "br", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.br", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json index 89b902675f43..0ad12da7b07b 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -162,12 +167,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -176,11 +181,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -199,6 +205,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -420,7 +436,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -975,8 +995,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1015,9 +1035,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1066,6 +1135,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json index 0b77179d4e63..4c83f200c89a 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.files.json @@ -20,9 +20,9 @@ "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.br", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.gz", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json index 064a60c1fa99..cc1f7167e2c8 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_PublishSingleFile_GeneratesPublishJsonManifestAndCopiesPublishAssets.Publish.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -208,12 +215,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -222,11 +229,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -323,12 +335,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\publish\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -337,11 +349,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -360,6 +373,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -567,6 +589,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -650,7 +676,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -659,6 +685,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -682,6 +709,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -705,6 +733,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -728,6 +757,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1389,8 +1419,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1429,9 +1459,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1480,6 +1559,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", @@ -1965,8 +2103,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [], "ResponseHeaders": [ { @@ -2005,9 +2143,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.br" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [ { "Name": "Content-Encoding", @@ -2056,6 +2243,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "br", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.br", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\${Rid}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json index c6695a55220f..345a2ff2f26d 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -208,12 +215,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -222,11 +229,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -374,7 +388,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1113,8 +1131,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1153,9 +1171,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1204,6 +1271,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Publish.files.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Publish.files.json index 2742db812e43..5ec7df796a4d 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Publish.files.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Publish.files.json @@ -48,9 +48,9 @@ "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.br", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.gz", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Publish.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Publish.staticwebassets.json index 4662fce51162..4a73096d5a56 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Publish.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/PublishProjectWithReferences_WorksWithStaticWebAssetsV1ClassLibraries.Publish.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -208,12 +215,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -222,11 +229,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -245,6 +253,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -415,12 +431,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -429,11 +445,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -452,6 +469,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -567,6 +589,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -581,7 +604,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -590,6 +613,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -659,6 +685,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1320,8 +1347,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1360,9 +1387,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1411,6 +1487,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", @@ -2264,8 +2399,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [], "ResponseHeaders": [ { @@ -2304,9 +2439,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.br" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [ { "Name": "Content-Encoding", @@ -2355,6 +2539,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "br", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.br", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.staticwebassets.json index ec7dd231feba..6d61bbb18347 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_IsBackwardsCompatible_WithPreviousVersions.Build.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -231,12 +239,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -245,11 +253,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -420,7 +436,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -429,6 +445,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -475,6 +493,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -498,6 +517,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1251,8 +1271,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1291,9 +1311,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1342,6 +1411,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.files.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.files.json index d7cf3c435b7b..0169d8614331 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.files.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.files.json @@ -54,9 +54,9 @@ "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.br", "${OutputPath}\\wwwroot\\_content\\ClassLibrary\\js\\project-transitive-dep.v4.js.gz", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", "${OutputPath}\\wwwroot\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.staticwebassets.json b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.staticwebassets.json index 1549676e01b1..36960f43d9f9 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.staticwebassets.json +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsBaselines/ScopedCss_PublishIsBackwardsCompatible_WithPreviousVersions.Publish.staticwebassets.json @@ -61,6 +61,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -84,6 +85,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -107,6 +109,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -130,6 +133,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -153,6 +157,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -176,6 +181,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -199,6 +205,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -222,6 +229,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -231,12 +239,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -245,11 +253,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -268,6 +277,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -291,6 +301,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -314,6 +325,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "gzip", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -337,6 +349,7 @@ "RelatedAsset": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\scopedcss\\bundle\\AppWithPackageAndP2PReference.styles.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -360,6 +373,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -383,6 +397,7 @@ "RelatedAsset": "${ProjectPath}\\AnotherClassLib\\wwwroot\\js\\project-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -406,6 +421,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\obj\\Debug\\${Tfm}\\scopedcss\\projectbundle\\ClassLibrary.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -429,6 +445,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -452,6 +469,7 @@ "RelatedAsset": "${ProjectPath}\\ClassLibrary\\wwwroot\\js\\project-transitive-dep.v4.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -461,12 +479,12 @@ "LastWriteTime": "0001-01-01T00:00:00+00:00" }, { - "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Identity": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "SourceId": "RazorPackageLibraryDirectDependency", "SourceType": "Package", "ContentRoot": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Alternative", @@ -475,11 +493,12 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", "CopyToPublishDirectory": "PreserveNewest", - "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "OriginalItemSpec": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "FileLength": -1, "LastWriteTime": "0001-01-01T00:00:00+00:00" }, @@ -498,6 +517,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\css\\site.css", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -521,6 +541,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\js\\pkg-direct-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -544,6 +565,7 @@ "RelatedAsset": "${RestorePath}\\razorpackagelibrarytransitivedependency\\${PackageVersion}\\staticwebassets\\js\\pkg-transitive-dep.js", "AssetTraitName": "Content-Encoding", "AssetTraitValue": "br", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -567,6 +589,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ApplicationBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -590,6 +613,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -613,6 +637,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -636,6 +661,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -650,7 +676,7 @@ "SourceType": "Package", "ContentRoot": "${RestorePath}\\razorpackagelibrarydirectdependency\\${PackageVersion}\\staticwebassets\\", "BasePath": "_content/RazorPackageLibraryDirectDependency", - "RelativePath": "RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "RelativePath": "RazorPackageLibraryDirectDependency#[.{fingerprint}]!.bundle.scp.css", "AssetKind": "All", "AssetMode": "Reference", "AssetRole": "Primary", @@ -659,6 +685,7 @@ "RelatedAsset": "", "AssetTraitName": "ScopedCss", "AssetTraitValue": "ProjectBundle", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -682,6 +709,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -705,6 +733,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -728,6 +757,7 @@ "RelatedAsset": "", "AssetTraitName": "", "AssetTraitValue": "", + "AssetGroups": "", "Fingerprint": "__fingerprint__", "Integrity": "__integrity__", "CopyToOutputDirectory": "Never", @@ -1481,8 +1511,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [], "ResponseHeaders": [ { @@ -1521,9 +1551,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.gz" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.gz", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", "Selectors": [ { "Name": "Content-Encoding", @@ -1572,6 +1651,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.gz", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "gzip", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "gzip" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.gz", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.gz", @@ -2517,8 +2655,8 @@ ] }, { - "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [], "ResponseHeaders": [ { @@ -2557,9 +2695,58 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "RazorPackageLibraryDirectDependency.bundle.scp.css.br" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css", - "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css.br", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", "Selectors": [ { "Name": "Content-Encoding", @@ -2608,6 +2795,65 @@ } ] }, + { + "Route": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.__fingerprint__.bundle.scp.css", + "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\RazorPackageLibraryDirectDependency#[.{fingerprint=__fingerprint__}]!.bundle.scp.css.br", + "Selectors": [ + { + "Name": "Content-Encoding", + "Value": "br", + "Quality": "__quality__" + } + ], + "ResponseHeaders": [ + { + "Name": "Cache-Control", + "Value": "max-age=31536000, immutable" + }, + { + "Name": "Content-Encoding", + "Value": "br" + }, + { + "Name": "Content-Length", + "Value": "__content-length__" + }, + { + "Name": "Content-Type", + "Value": "text/css" + }, + { + "Name": "ETag", + "Value": "__etag__" + }, + { + "Name": "Last-Modified", + "Value": "__last-modified__" + }, + { + "Name": "Vary", + "Value": "Accept-Encoding" + } + ], + "EndpointProperties": [ + { + "Name": "fingerprint", + "Value": "__fingerprint__" + }, + { + "Name": "integrity", + "Value": "__integrity__" + }, + { + "Name": "label", + "Value": "_content/RazorPackageLibraryDirectDependency/RazorPackageLibraryDirectDependency.bundle.scp.css" + }, + { + "Name": "original-resource", + "Value": "__original-resource__" + } + ] + }, { "Route": "_content/RazorPackageLibraryDirectDependency/css/site.css.br", "AssetFile": "${ProjectPath}\\AppWithPackageAndP2PReference\\obj\\Debug\\${Tfm}\\compressed\\publish\\_content\\RazorPackageLibraryDirectDependency\\css\\site.css.br", diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsPackIntegrationTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsPackIntegrationTest.cs index 9fb271500d50..a42564667788 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsPackIntegrationTest.cs +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssetsPackIntegrationTest.cs @@ -57,10 +57,11 @@ public void Pack_IncludesStaticWebAssets() Path.Combine("staticwebassets", "js", "pkg-direct-dep.js"), Path.Combine("staticwebassets", "css", "site.css"), Path.Combine("staticwebassets", "PackageLibraryDirectDependency.*.bundle.scp.css"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "PackageLibraryDirectDependency.props"), - Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.props"), - Path.Combine("buildTransitive", "PackageLibraryDirectDependency.props") + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "PackageLibraryDirectDependency.PackageAssets.json"), + Path.Combine("build", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildTransitive", "PackageLibraryDirectDependency.targets") }); } @@ -152,10 +153,11 @@ public void Pack_Incremental_IncludesStaticWebAssets() Path.Combine("staticwebassets", "js", "pkg-direct-dep.js"), Path.Combine("staticwebassets", "css", "site.css"), Path.Combine("staticwebassets", "PackageLibraryDirectDependency.*.bundle.scp.css"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "PackageLibraryDirectDependency.props"), - Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.props"), - Path.Combine("buildTransitive", "PackageLibraryDirectDependency.props") + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "PackageLibraryDirectDependency.PackageAssets.json"), + Path.Combine("build", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildTransitive", "PackageLibraryDirectDependency.targets") }); } @@ -184,30 +186,18 @@ public void Pack_StaticWebAssets_WithoutFileExtension_AreCorrectlyPacked() Path.Combine("staticwebassets", "css", "site.css"), Path.Combine("staticwebassets", "LICENSE"), Path.Combine("staticwebassets", "PackageLibraryDirectDependency.*.bundle.scp.css"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "PackageLibraryDirectDependency.props"), - Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.props"), - Path.Combine("buildTransitive", "PackageLibraryDirectDependency.props") + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "PackageLibraryDirectDependency.PackageAssets.json"), + Path.Combine("build", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildTransitive", "PackageLibraryDirectDependency.targets") }); } [Fact] public void Pack_MultipleTargetFrameworks_Works() { - var testAsset = "PackageLibraryDirectDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges((project, document) => - { - var tfm = document.Descendants("TargetFramework").Single(); - tfm.Name = "TargetFrameworks"; - tfm.FirstNode.ReplaceWith(tfm.FirstNode.ToString() + ";netstandard2.1"); - - document.Descendants("AddRazorSupportForMvc").SingleOrDefault()?.Remove(); - document.Descendants("FrameworkReference").SingleOrDefault()?.Remove(); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "PackageLibraryDirectDependency", "Components"), recursive: true); + var projectDirectory = SetupMultiTargetProject(); var pack = CreatePackCommand(projectDirectory, "PackageLibraryDirectDependency"); var result = ExecuteCommand(pack); @@ -224,30 +214,18 @@ public void Pack_MultipleTargetFrameworks_Works() { Path.Combine("staticwebassets", "js", "pkg-direct-dep.js"), Path.Combine("staticwebassets", "css", "site.css"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "PackageLibraryDirectDependency.props"), - Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.props"), - Path.Combine("buildTransitive", "PackageLibraryDirectDependency.props") + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "PackageLibraryDirectDependency.PackageAssets.json"), + Path.Combine("build", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildTransitive", "PackageLibraryDirectDependency.targets") }); } [Fact] public void Pack_MultipleTargetFrameworks_NoBuild_IncludesStaticWebAssets() { - var testAsset = "PackageLibraryDirectDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges((project, document) => - { - var tfm = document.Descendants("TargetFramework").Single(); - tfm.Name = "TargetFrameworks"; - tfm.FirstNode.ReplaceWith(tfm.FirstNode.ToString() + ";netstandard2.1"); - - document.Descendants("AddRazorSupportForMvc").SingleOrDefault()?.Remove(); - document.Descendants("FrameworkReference").SingleOrDefault()?.Remove(); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "PackageLibraryDirectDependency", "Components"), recursive: true); + var projectDirectory = SetupMultiTargetProject(); var build = CreateBuildCommand(projectDirectory, "PackageLibraryDirectDependency"); var buildResult = build.Execute(); @@ -267,30 +245,18 @@ public void Pack_MultipleTargetFrameworks_NoBuild_IncludesStaticWebAssets() { Path.Combine("staticwebassets", "js", "pkg-direct-dep.js"), Path.Combine("staticwebassets", "css", "site.css"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "PackageLibraryDirectDependency.props"), - Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.props"), - Path.Combine("buildTransitive", "PackageLibraryDirectDependency.props") + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "PackageLibraryDirectDependency.PackageAssets.json"), + Path.Combine("build", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildTransitive", "PackageLibraryDirectDependency.targets") }); } [Fact] public void Pack_MultipleTargetFrameworks_NoBuild_DoesNotIncludeAssetsAsContent() { - var testAsset = "PackageLibraryDirectDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges((project, document) => - { - var tfm = document.Descendants("TargetFramework").Single(); - tfm.Name = "TargetFrameworks"; - tfm.FirstNode.ReplaceWith(tfm.FirstNode.ToString() + ";netstandard2.1"); - - document.Descendants("AddRazorSupportForMvc").SingleOrDefault()?.Remove(); - document.Descendants("FrameworkReference").SingleOrDefault()?.Remove(); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "PackageLibraryDirectDependency", "Components"), recursive: true); + var projectDirectory = SetupMultiTargetProject(); var build = CreateBuildCommand(projectDirectory, "PackageLibraryDirectDependency"); var buildResult = build.Execute(); @@ -318,20 +284,7 @@ public void Pack_MultipleTargetFrameworks_NoBuild_DoesNotIncludeAssetsAsContent( [Fact] public void Pack_MultipleTargetFrameworks_GeneratePackageOnBuild_IncludesStaticWebAssets() { - var testAsset = "PackageLibraryDirectDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges((project, document) => - { - var tfm = document.Descendants("TargetFramework").Single(); - tfm.Name = "TargetFrameworks"; - tfm.FirstNode.ReplaceWith(tfm.FirstNode.ToString() + ";netstandard2.1"); - - document.Descendants("AddRazorSupportForMvc").SingleOrDefault()?.Remove(); - document.Descendants("FrameworkReference").SingleOrDefault()?.Remove(); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "PackageLibraryDirectDependency", "Components"), recursive: true); + var projectDirectory = SetupMultiTargetProject(); var build = CreateBuildCommand(projectDirectory, "PackageLibraryDirectDependency"); var result = build.Execute("/p:GeneratePackageOnBuild=true"); @@ -348,30 +301,18 @@ public void Pack_MultipleTargetFrameworks_GeneratePackageOnBuild_IncludesStaticW { Path.Combine("staticwebassets", "js", "pkg-direct-dep.js"), Path.Combine("staticwebassets", "css", "site.css"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "PackageLibraryDirectDependency.props"), - Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.props"), - Path.Combine("buildTransitive", "PackageLibraryDirectDependency.props") + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "PackageLibraryDirectDependency.PackageAssets.json"), + Path.Combine("build", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildTransitive", "PackageLibraryDirectDependency.targets") }); } [Fact] public void Pack_MultipleTargetFrameworks_GeneratePackageOnBuild_DoesNotIncludeAssetsAsContent() { - var testAsset = "PackageLibraryDirectDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges((project, document) => - { - var tfm = document.Descendants("TargetFramework").Single(); - tfm.Name = "TargetFrameworks"; - tfm.FirstNode.ReplaceWith(tfm.FirstNode.ToString() + ";netstandard2.1"); - - document.Descendants("AddRazorSupportForMvc").SingleOrDefault()?.Remove(); - document.Descendants("FrameworkReference").SingleOrDefault()?.Remove(); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "PackageLibraryDirectDependency", "Components"), recursive: true); + var projectDirectory = SetupMultiTargetProject(); var build = CreateBuildCommand(projectDirectory, "PackageLibraryDirectDependency"); var result = build.Execute("/p:GeneratePackageOnBuild=true"); @@ -396,42 +337,7 @@ public void Pack_MultipleTargetFrameworks_GeneratePackageOnBuild_DoesNotIncludeA [Fact] public void Pack_BeforeNet60_MultipleTargetFrameworks_WithScopedCss_IncludesAssetsAndProjectBundle() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - netstandard2.0;net5.0 - 3.0 - - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupBeforeNet60ScopedCssProject(); var pack = CreatePackCommand(projectDirectory); var result = ExecuteCommand(pack); @@ -465,42 +371,7 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_BeforeNet60_MultipleTargetFrameworks_WithScopedCss_DoesNotIncludeAssetsAsContent() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - netstandard2.0;net5.0 - 3.0 - - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupBeforeNet60ScopedCssProject(); var pack = CreatePackCommand(projectDirectory); var result = ExecuteCommand(pack); @@ -533,42 +404,7 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_BeforeNet60_MultipleTargetFrameworks_NoBuild_WithScopedCss_IncludesAssetsAndProjectBundle() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - netstandard2.0;net5.0 - 3.0 - - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupBeforeNet60ScopedCssProject(); var build = CreateBuildCommand(projectDirectory); var buildResult = build.Execute(); @@ -607,42 +443,7 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_BeforeNet60_MultipleTargetFrameworks_NoBuild_WithScopedCss_DoesNotIncludeAssetsAsContent() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - netstandard2.0;net5.0 - 3.0 - - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupBeforeNet60ScopedCssProject(); var build = CreateBuildCommand(projectDirectory); var buildResult = build.Execute(); @@ -680,42 +481,7 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_BeforeNet60_MultipleTargetFrameworks_GeneratePackageOnBuild_WithScopedCss_IncludesAssetsAndProjectBundle() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - netstandard2.0;net5.0 - 3.0 - - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupBeforeNet60ScopedCssProject(); var build = CreateBuildCommand(projectDirectory); var result = build.Execute("/p:GeneratePackageOnBuild=true"); @@ -749,42 +515,7 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_BeforeNet60_MultipleTargetFrameworks_GeneratePackageOnBuild_WithScopedCss_DoesNotIncludeAssetsAsContent() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - netstandard2.0;net5.0 - 3.0 - - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupBeforeNet60ScopedCssProject(); var build = CreateBuildCommand(projectDirectory); var result = build.Execute("/p:GeneratePackageOnBuild=true"); @@ -816,41 +547,8 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_Net50_WithScopedCss_IncludesAssetsAndProjectBundle() - { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - net5.0 - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + { + var projectDirectory = SetupNet50ScopedCssProject(); var pack = CreatePackCommand(projectDirectory); var result = ExecuteCommand(pack); @@ -884,40 +582,7 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_Net50_WithScopedCss_DoesNotIncludeAssetsAsContent() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - net5.0 - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupNet50ScopedCssProject(); var pack = CreatePackCommand(projectDirectory); var result = ExecuteCommand(pack); @@ -950,40 +615,7 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_Net50_NoBuild_WithScopedCss_IncludesAssetsAndProjectBundle() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - net5.0 - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupNet50ScopedCssProject(); var build = CreateBuildCommand(projectDirectory); var buildResult = build.Execute(); @@ -1022,40 +654,7 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_Net50_NoBuild_WithScopedCss_DoesNotIncludeAssetsAsContent() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - net5.0 - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupNet50ScopedCssProject(); var build = CreateBuildCommand(projectDirectory); var buildResult = build.Execute(); @@ -1093,40 +692,7 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_Net50_GeneratePackageOnBuild_WithScopedCss_IncludesAssetsAndProjectBundle() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - net5.0 - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupNet50ScopedCssProject(); var build = CreateBuildCommand(projectDirectory); var result = build.Execute("/p:GeneratePackageOnBuild=true"); @@ -1160,40 +726,7 @@ This component is defined in the razorclasslibrarypack library. [Fact] public void Pack_Net50_GeneratePackageOnBuild_WithScopedCss_DoesNotIncludeAssetsAsContent() { - var testAsset = "PackageLibraryTransitiveDependency"; - var projectDirectory = CreateAspNetSdkTestAsset(testAsset, subdirectory: "TestPackages"); - - projectDirectory.WithProjectChanges(document => - { - var parse = XDocument.Parse($@" - - - net5.0 - - - - - - - -"); - document.Root.ReplaceWith(parse.Root); - }); - - Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); - - var componentText = @"
- This component is defined in the razorclasslibrarypack library. -
"; - - // This mimics the structure of our default template project - Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); - File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); - File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); - File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + var projectDirectory = SetupNet50ScopedCssProject(); var build = CreateBuildCommand(projectDirectory); var result = build.Execute("/p:GeneratePackageOnBuild=true"); @@ -1291,10 +824,11 @@ This component is defined in the razorclasslibrarypack library. Path.Combine("staticwebassets", "Component1.razor.js"), Path.Combine("staticwebassets", "PackageLibraryTransitiveDependency.*.bundle.scp.css"), Path.Combine("staticwebassets", "PackageLibraryTransitiveDependency.*.lib.module.js"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "PackageLibraryTransitiveDependency.props"), - Path.Combine("buildMultiTargeting", "PackageLibraryTransitiveDependency.props"), - Path.Combine("buildTransitive", "PackageLibraryTransitiveDependency.props") + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "PackageLibraryTransitiveDependency.PackageAssets.json"), + Path.Combine("build", "PackageLibraryTransitiveDependency.targets"), + Path.Combine("buildMultiTargeting", "PackageLibraryTransitiveDependency.targets"), + Path.Combine("buildTransitive", "PackageLibraryTransitiveDependency.targets") }); } @@ -1368,10 +902,11 @@ This component is defined in the razorclasslibrarypack library. Path.Combine("staticwebassets", "Component1.razor.js"), Path.Combine("staticwebassets", "PackageLibraryTransitiveDependency.*.bundle.scp.css"), Path.Combine("staticwebassets", "PackageLibraryTransitiveDependency.*.lib.module.js"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "PackageLibraryTransitiveDependency.props"), - Path.Combine("buildMultiTargeting", "PackageLibraryTransitiveDependency.props"), - Path.Combine("buildTransitive", "PackageLibraryTransitiveDependency.props") + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "PackageLibraryTransitiveDependency.PackageAssets.json"), + Path.Combine("build", "PackageLibraryTransitiveDependency.targets"), + Path.Combine("buildMultiTargeting", "PackageLibraryTransitiveDependency.targets"), + Path.Combine("buildTransitive", "PackageLibraryTransitiveDependency.targets") }); } @@ -1559,10 +1094,11 @@ public void Pack_NoBuild_IncludesStaticWebAssets() Path.Combine("staticwebassets", "js", "pkg-direct-dep.js"), Path.Combine("staticwebassets", "PackageLibraryDirectDependency.*.bundle.scp.css"), Path.Combine("staticwebassets", "css", "site.css"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "PackageLibraryDirectDependency.props"), - Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.props"), - Path.Combine("buildTransitive", "PackageLibraryDirectDependency.props") + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "PackageLibraryDirectDependency.PackageAssets.json"), + Path.Combine("build", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildTransitive", "PackageLibraryDirectDependency.targets") }); } @@ -1635,19 +1171,19 @@ public void Pack_Incremental_DoesNotRegenerateCacheAndPropsFiles() new FileInfo(Path.Combine(outputPath, "PackageLibraryTransitiveDependency.dll")).Should().Exist(); - new FileInfo(Path.Combine(intermediateOutputPath, "staticwebassets", "msbuild.PackageLibraryTransitiveDependency.Microsoft.AspNetCore.StaticWebAssets.props")).Should().Exist(); - new FileInfo(Path.Combine(intermediateOutputPath, "staticwebassets", "msbuild.build.PackageLibraryTransitiveDependency.props")).Should().Exist(); - new FileInfo(Path.Combine(intermediateOutputPath, "staticwebassets", "msbuild.buildMultiTargeting.PackageLibraryTransitiveDependency.props")).Should().Exist(); - new FileInfo(Path.Combine(intermediateOutputPath, "staticwebassets", "msbuild.buildTransitive.PackageLibraryTransitiveDependency.props")).Should().Exist(); + new FileInfo(Path.Combine(intermediateOutputPath, "staticwebassets", "msbuild.PackageLibraryTransitiveDependency.Microsoft.AspNetCore.StaticWebAssets.targets")).Should().Exist(); + new FileInfo(Path.Combine(intermediateOutputPath, "staticwebassets", "msbuild.build.PackageLibraryTransitiveDependency.targets")).Should().Exist(); + new FileInfo(Path.Combine(intermediateOutputPath, "staticwebassets", "msbuild.buildMultiTargeting.PackageLibraryTransitiveDependency.targets")).Should().Exist(); + new FileInfo(Path.Combine(intermediateOutputPath, "staticwebassets", "msbuild.buildTransitive.PackageLibraryTransitiveDependency.targets")).Should().Exist(); var directoryPath = Path.Combine(intermediateOutputPath, "staticwebassets"); var thumbPrints = new Dictionary(); var thumbPrintFiles = new[] { - Path.Combine(directoryPath, "msbuild.PackageLibraryTransitiveDependency.Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine(directoryPath, "msbuild.build.PackageLibraryTransitiveDependency.props"), - Path.Combine(directoryPath, "msbuild.buildMultiTargeting.PackageLibraryTransitiveDependency.props"), - Path.Combine(directoryPath, "msbuild.buildTransitive.PackageLibraryTransitiveDependency.props"), + Path.Combine(directoryPath, "msbuild.PackageLibraryTransitiveDependency.Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine(directoryPath, "msbuild.build.PackageLibraryTransitiveDependency.targets"), + Path.Combine(directoryPath, "msbuild.buildMultiTargeting.PackageLibraryTransitiveDependency.targets"), + Path.Combine(directoryPath, "msbuild.buildTransitive.PackageLibraryTransitiveDependency.targets"), }; foreach (var file in thumbPrintFiles) @@ -1690,10 +1226,11 @@ public void Build_StaticWebAssets_GeneratePackageOnBuild_PacksStaticWebAssets() Path.Combine("staticwebassets", "js", "pkg-direct-dep.js"), Path.Combine("staticwebassets", "css", "site.css"), Path.Combine("staticwebassets", "PackageLibraryDirectDependency.*.bundle.scp.css"), - Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.props"), - Path.Combine("build", "PackageLibraryDirectDependency.props"), - Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.props"), - Path.Combine("buildTransitive", "PackageLibraryDirectDependency.props") + Path.Combine("build", "Microsoft.AspNetCore.StaticWebAssets.targets"), + Path.Combine("build", "PackageLibraryDirectDependency.PackageAssets.json"), + Path.Combine("build", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildMultiTargeting", "PackageLibraryDirectDependency.targets"), + Path.Combine("buildTransitive", "PackageLibraryDirectDependency.targets") }); } @@ -1726,5 +1263,92 @@ public void Build_StaticWebAssets_GeneratePackageOnBuild_DoesNotIncludeAssetsAsC Path.Combine("contentFiles", "PackageLibraryDirectDependency.bundle.scp.css"), }); } + + private TestAsset SetupMultiTargetProject() + { + var projectDirectory = CreateAspNetSdkTestAsset("PackageLibraryDirectDependency", subdirectory: "TestPackages"); + + projectDirectory.WithProjectChanges((project, document) => + { + var tfm = document.Descendants("TargetFramework").Single(); + tfm.Name = "TargetFrameworks"; + tfm.FirstNode.ReplaceWith(tfm.FirstNode.ToString() + ";netstandard2.1"); + + document.Descendants("AddRazorSupportForMvc").SingleOrDefault()?.Remove(); + document.Descendants("FrameworkReference").SingleOrDefault()?.Remove(); + }); + + Directory.Delete(Path.Combine(projectDirectory.Path, "PackageLibraryDirectDependency", "Components"), recursive: true); + return projectDirectory; + } + + private TestAsset SetupBeforeNet60ScopedCssProject() + { + var projectDirectory = CreateAspNetSdkTestAsset("PackageLibraryTransitiveDependency", subdirectory: "TestPackages"); + + projectDirectory.WithProjectChanges(document => + { + var parse = XDocument.Parse($@" + + + netstandard2.0;net5.0 + 3.0 + + + + + + + + +"); + document.Root.ReplaceWith(parse.Root); + }); + + SetupScopedCssFiles(projectDirectory); + return projectDirectory; + } + + private TestAsset SetupNet50ScopedCssProject() + { + var projectDirectory = CreateAspNetSdkTestAsset("PackageLibraryTransitiveDependency", subdirectory: "TestPackages"); + + projectDirectory.WithProjectChanges(document => + { + var parse = XDocument.Parse($@" + + + net5.0 + + + + + + + +"); + document.Root.ReplaceWith(parse.Root); + }); + + SetupScopedCssFiles(projectDirectory); + return projectDirectory; + } + + private static void SetupScopedCssFiles(TestAsset projectDirectory) + { + Directory.Delete(Path.Combine(projectDirectory.Path, "wwwroot"), recursive: true); + + var componentText = @"
+ This component is defined in the razorclasslibrarypack library. +
"; + + Directory.CreateDirectory(Path.Combine(projectDirectory.Path, "wwwroot")); + File.WriteAllText(Path.Combine(projectDirectory.Path, "_Imports.razor"), "@using Microsoft.AspNetCore.Components.Web" + Environment.NewLine); + File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor"), componentText); + File.WriteAllText(Path.Combine(projectDirectory.Path, "Component1.razor.css"), ""); + File.WriteAllText(Path.Combine(projectDirectory.Path, "ExampleJsInterop.cs"), ""); + File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "background.png"), ""); + File.WriteAllText(Path.Combine(projectDirectory.Path, "wwwroot", "exampleJsInterop.js"), ""); + } } } From 727ca0b479268de382df49697f1c141b7bcf67ac Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 17:05:52 +0100 Subject: [PATCH 05/20] Parse group definitions at Execute start and pass as parameter Move ParseGroupDefinitions() call from ApplyGroupDefinitions() to the beginning of Execute(). The parsed definitions list is now a local variable passed into ApplyGroupDefinitions(definitions) rather than re-parsed on every call. Validation errors (duplicate Order+SourceId) are caught before any asset processing begins. --- .../Tasks/DefineStaticWebAssets.cs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs index d8e866f96cdb..0fbe3af8a39b 100644 --- a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs @@ -82,6 +82,19 @@ public partial class DefineStaticWebAssets : Task public override bool Execute() { _overrides = new HashSet(PropertyOverrides ?? [], StringComparer.OrdinalIgnoreCase); + + // Parse group definitions once upfront so they can be applied per-asset inside the loop. + List groupDefinitions = null; + if (StaticWebAssetGroupDefinitions != null && StaticWebAssetGroupDefinitions.Length > 0) + { + groupDefinitions = ParseGroupDefinitions(); + if (groupDefinitions == null) + { + return false; // Validation error already logged + } + Log.LogMessage(MessageImportance.Low, "Parsed {0} group definitions.", groupDefinitions.Count); + } + var assetsCache = GetOrCreateAssetsCache(); if (assetsCache.IsUpToDate()) @@ -326,10 +339,10 @@ public override bool Execute() } } - if (!Log.HasLoggedErrors && StaticWebAssetGroupDefinitions != null && StaticWebAssetGroupDefinitions.Length > 0) + if (!Log.HasLoggedErrors && groupDefinitions != null) { - Log.LogMessage(MessageImportance.Low, "Applying group definitions. Definitions count: {0}, Assets count: {1}", StaticWebAssetGroupDefinitions.Length, Assets.Length); - ApplyGroupDefinitions(); + Log.LogMessage(MessageImportance.Low, "Applying group definitions. Definitions count: {0}, Assets count: {1}", groupDefinitions.Count, Assets.Length); + ApplyGroupDefinitions(groupDefinitions); } return !Log.HasLoggedErrors; @@ -604,14 +617,8 @@ private string GetDiscoveryCandidateMatchPath(ITaskItem candidate) return computedPath; } - private void ApplyGroupDefinitions() + private void ApplyGroupDefinitions(List definitions) { - var definitions = ParseGroupDefinitions(); - if (definitions == null) - { - return; // Error already logged - } - var matchContext = StaticWebAssetGlobMatcher.CreateMatchContext(); for (var i = 0; i < Assets.Length; i++) From 6224a3c118f4969db44dc1bb37fe091592b7c158 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 17:07:08 +0100 Subject: [PATCH 06/20] Apply group definitions per-asset before ToTaskItem Replace the post-loop ApplyGroupDefinitions() bulk operation with a per-asset ApplyGroupToAsset() call inside the main processing loop. Group definitions are now applied to each StaticWebAsset instance before it is serialized via ToTaskItem(), eliminating the need to re-parse ITaskItem back to StaticWebAsset after the fact. This means group-modified RelativePath and ContentRoot values are visible to UpdateAssetKindIfNecessary for dedup/conflict detection. --- .../Tasks/DefineStaticWebAssets.cs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs index 0fbe3af8a39b..6ac44b2840a7 100644 --- a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs @@ -315,6 +315,16 @@ public override bool Execute() asset.AssetGroups = existingGroups; } + // Apply group definitions to this individual asset before serializing to ITaskItem. + if (groupDefinitions != null) + { + ApplyGroupToAsset(ref asset, groupDefinitions, matchContext); + if (Log.HasLoggedErrors) + { + break; + } + } + var item = asset.ToTaskItem(); if (SourceType == StaticWebAsset.SourceTypes.Discovered) { @@ -339,12 +349,6 @@ public override bool Execute() } } - if (!Log.HasLoggedErrors && groupDefinitions != null) - { - Log.LogMessage(MessageImportance.Low, "Applying group definitions. Definitions count: {0}, Assets count: {1}", groupDefinitions.Count, Assets.Length); - ApplyGroupDefinitions(groupDefinitions); - } - return !Log.HasLoggedErrors; } @@ -617,24 +621,20 @@ private string GetDiscoveryCandidateMatchPath(ITaskItem candidate) return computedPath; } - private void ApplyGroupDefinitions(List definitions) + private void ApplyGroupToAsset( + ref StaticWebAsset asset, + List definitions, + StaticWebAssetGlobMatcher.MatchContext matchContext) { - var matchContext = StaticWebAssetGlobMatcher.CreateMatchContext(); + var (groupEntries, newRelativePath, contentRootSuffix) = MatchAssetToDefinitions(asset, definitions, matchContext); - for (var i = 0; i < Assets.Length; i++) + if (groupEntries != null && groupEntries.Count > 0) { - var asset = StaticWebAsset.FromTaskItem(Assets[i]); - var (groupEntries, newRelativePath, contentRootSuffix) = MatchAssetToDefinitions(asset, definitions, matchContext); - - if (groupEntries != null && groupEntries.Count > 0) + asset.AssetGroups = string.Join(";", groupEntries); + asset.RelativePath = newRelativePath; + if (contentRootSuffix != null) { - asset.AssetGroups = string.Join(";", groupEntries); - asset.RelativePath = newRelativePath; - if (contentRootSuffix != null) - { - ApplyContentRootSuffix(ref asset, contentRootSuffix.Value.Suffix, contentRootSuffix.Value.GroupName); - } - Assets[i] = asset.ToTaskItem(); + ApplyContentRootSuffix(ref asset, contentRootSuffix.Value.Suffix, contentRootSuffix.Value.GroupName); } } } From 9b6a71684831d4e4385d2bdd593aae02eb7f3b84 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 17:08:29 +0100 Subject: [PATCH 07/20] Use pre-group RelativePath for UpdateAssetKindIfNecessary dedup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Group definitions can rewrite RelativePath so that assets from different groups (e.g. V4/css/site.css and V5/css/site.css) collapse to the same post-group path (css/site.css). UpdateAssetKindIfNecessary must use the original pre-group path for its conflict detection, since group variants are not true conflicts — they are resolved at runtime by FilterStaticWebAssetGroups. --- src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs index 6ac44b2840a7..f6f58aafe238 100644 --- a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs @@ -315,6 +315,11 @@ public override bool Execute() asset.AssetGroups = existingGroups; } + // Capture the pre-group relative path for dedup — group definitions may rewrite + // RelativePath so that two grouped assets (e.g. V4/css/site.css, V5/css/site.css) + // share the same post-group path. Dedup must use the original path. + var dedupRelativePath = asset.RelativePath; + // Apply group definitions to this individual asset before serializing to ITaskItem. if (groupDefinitions != null) { @@ -329,7 +334,7 @@ public override bool Execute() if (SourceType == StaticWebAsset.SourceTypes.Discovered) { item.SetMetadata(nameof(StaticWebAsset.AssetKind), !asset.ShouldCopyToPublishDirectory() ? StaticWebAsset.AssetKinds.Build : StaticWebAsset.AssetKinds.All); - UpdateAssetKindIfNecessary(assetsByRelativePath, asset.RelativePath, item); + UpdateAssetKindIfNecessary(assetsByRelativePath, dedupRelativePath, item); } assetsCache.AppendAsset(hash, asset, item); From dda18d791f01ee97c09ec63aa10f6188fbdd8088 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 17:40:20 +0100 Subject: [PATCH 08/20] Validate required group definition properties at parse time --- .../Tasks/DefineStaticWebAssets.cs | 26 ++++++++++++++----- .../AssetGroupFilteringTest.cs | 8 ++++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs index f6f58aafe238..ba3ec12a4464 100644 --- a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs @@ -687,14 +687,32 @@ private List ParseGroupDefinitions() { var name = def.ItemSpec; var value = def.GetMetadata("Value"); + if (string.IsNullOrEmpty(value)) + { + Log.LogError("Group definition '{0}' is missing required metadata 'Value'.", name); + return null; + } + var sourceId = def.GetMetadata("SourceId"); + if (string.IsNullOrEmpty(sourceId)) + { + Log.LogError("Group definition '{0}' is missing required metadata 'SourceId'.", name); + return null; + } + var orderStr = def.GetMetadata("Order"); if (!int.TryParse(orderStr, out var order)) { - order = 0; + Log.LogError("Group definition '{0}' has invalid or missing 'Order' value '{1}'. Order must be an integer.", name, orderStr); + return null; } var includePattern = def.GetMetadata("IncludePattern"); + if (string.IsNullOrEmpty(includePattern)) + { + Log.LogError("Group definition '{0}' is missing required metadata 'IncludePattern'.", name); + return null; + } var excludePattern = def.GetMetadata("ExcludePattern"); var relativePathPattern = def.GetMetadata("RelativePathPattern"); var relativePathPrefix = def.GetMetadata("RelativePathPrefix"); @@ -759,12 +777,6 @@ private List ParseGroupDefinitions() foreach (var def in definitions) { - if (def.IncludeMatcher == null) - { - Log.LogMessage(MessageImportance.Low, - "Skipping group definition '{0}' because it has no IncludePattern.", def.Name); - continue; - } matchContext.SetPathAndReinitialize(pathWithoutTokens); var includeMatch = def.IncludeMatcher.Match(matchContext); diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs index f1724f164ee4..a718a1f505c3 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs @@ -487,6 +487,7 @@ public void ApplyGroupDefinitions_ContentRootSuffix_AdjustsContentRoot() { ["Value"] = "V4", ["Order"] = "0", + ["SourceId"] = "IdentityUI", ["IncludePattern"] = "V4/**", ["RelativePathPattern"] = "V4/**", ["ContentRootSuffix"] = "V4" @@ -520,6 +521,7 @@ public void ApplyGroupDefinitions_PatternOnly_NoAutoFileOnlyToken() { ["Value"] = "V4", ["Order"] = "0", + ["SourceId"] = "IdentityUI", ["IncludePattern"] = "V4/**", ["RelativePathPattern"] = "V4/**" // No RelativePathPrefix, no ContentRootSuffix @@ -553,6 +555,7 @@ public void ApplyGroupDefinitions_RelativePathPrefix_FileOnlyToken() { ["Value"] = "V4", ["Order"] = "0", + ["SourceId"] = "IdentityUI", ["IncludePattern"] = "V4/**", ["RelativePathPattern"] = "V4/**", ["RelativePathPrefix"] = "#[{BootstrapVersion}/]~" @@ -586,6 +589,7 @@ public void ApplyGroupDefinitions_RelativePathPrefix_LiteralPrepend() { ["Value"] = "V4", ["Order"] = "0", + ["SourceId"] = "IdentityUI", ["IncludePattern"] = "V4/**", ["RelativePathPattern"] = "V4/**", ["RelativePathPrefix"] = "shared/" @@ -618,6 +622,7 @@ public void ApplyGroupDefinitions_AllThreeOrthogonal() { ["Value"] = "V4", ["Order"] = "0", + ["SourceId"] = "IdentityUI", ["IncludePattern"] = "V4/**", ["RelativePathPattern"] = "V4/**", ["RelativePathPrefix"] = "shared/", @@ -653,6 +658,7 @@ public void ApplyGroupDefinitions_RelativePathPrefix_WithoutPattern_PrependsToOr { ["Value"] = "Default", ["Order"] = "0", + ["SourceId"] = "MyLib", ["IncludePattern"] = "**", ["RelativePathPrefix"] = "lib/" // No RelativePathPattern — no stripping, just prepend @@ -692,6 +698,7 @@ public void ApplyGroupDefinitions_ContentRootSuffix_MultipleGroups_EachGetsOwnCo { ["Value"] = "V5", ["Order"] = "0", + ["SourceId"] = "IdentityUI", ["IncludePattern"] = "V5/**", ["RelativePathPattern"] = "V5/**", ["ContentRootSuffix"] = "V5" @@ -700,6 +707,7 @@ public void ApplyGroupDefinitions_ContentRootSuffix_MultipleGroups_EachGetsOwnCo { ["Value"] = "V4", ["Order"] = "1", + ["SourceId"] = "IdentityUI", ["IncludePattern"] = "V4/**", ["RelativePathPattern"] = "V4/**", ["ContentRootSuffix"] = "V4" From 0e8f737823d4823d402a1450520b82b84f1ee460 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 17:44:07 +0100 Subject: [PATCH 09/20] Replace MatchAssetToDefinitions return tuple with GroupMatchResult struct --- .../Tasks/DefineStaticWebAssets.cs | 44 ++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs index ba3ec12a4464..6479132f32dd 100644 --- a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs @@ -631,19 +631,39 @@ private void ApplyGroupToAsset( List definitions, StaticWebAssetGlobMatcher.MatchContext matchContext) { - var (groupEntries, newRelativePath, contentRootSuffix) = MatchAssetToDefinitions(asset, definitions, matchContext); + var result = MatchAssetToDefinitions(asset, definitions, matchContext); - if (groupEntries != null && groupEntries.Count > 0) + if (result.GroupEntries != null && result.GroupEntries.Count > 0) { - asset.AssetGroups = string.Join(";", groupEntries); - asset.RelativePath = newRelativePath; - if (contentRootSuffix != null) + asset.AssetGroups = string.Join(";", result.GroupEntries); + asset.RelativePath = result.RelativePath; + if (result.ContentRootSuffix != null) { - ApplyContentRootSuffix(ref asset, contentRootSuffix.Value.Suffix, contentRootSuffix.Value.GroupName); + ApplyContentRootSuffix(ref asset, result.ContentRootSuffix, result.ContentRootGroupName); } } } + private readonly struct GroupMatchResult + { + public GroupMatchResult( + List groupEntries, + string relativePath, + string contentRootSuffix, + string contentRootGroupName) + { + GroupEntries = groupEntries; + RelativePath = relativePath; + ContentRootSuffix = contentRootSuffix; + ContentRootGroupName = contentRootGroupName; + } + + public List GroupEntries { get; } + public string RelativePath { get; } + public string ContentRootSuffix { get; } + public string ContentRootGroupName { get; } + } + private readonly struct GroupDefinition { public GroupDefinition( @@ -766,14 +786,15 @@ private List ParseGroupDefinitions() return definitions; } - private (List GroupEntries, string RelativePath, (string Suffix, string GroupName)? ContentRootSuffix) MatchAssetToDefinitions( + private GroupMatchResult MatchAssetToDefinitions( StaticWebAsset asset, List definitions, StaticWebAssetGlobMatcher.MatchContext matchContext) { var currentRelativePath = asset.RelativePath; var pathWithoutTokens = StaticWebAssetPathPattern.PathWithoutTokens(currentRelativePath); var groupEntries = new List(); var groupValues = new Dictionary(StringComparer.Ordinal); - (string Suffix, string GroupName)? contentRootSuffix = null; + string contentRootSuffix = null; + string contentRootGroupName = null; foreach (var def in definitions) { @@ -802,7 +823,7 @@ private List ParseGroupDefinitions() { Log.LogError("Asset '{0}' matched group definitions for '{1}' with conflicting values '{2}' and '{3}'. Glob patterns must be non-overlapping for the same group name with different values.", asset.Identity, def.Name, existingValue, def.Value); - return (null, null, null); + return default; } continue; } @@ -844,11 +865,12 @@ private List ParseGroupDefinitions() if (!string.IsNullOrEmpty(def.ContentRootSuffix)) { - contentRootSuffix = (def.ContentRootSuffix, def.Name); + contentRootSuffix = def.ContentRootSuffix; + contentRootGroupName = def.Name; } } - return (groupEntries, currentRelativePath, contentRootSuffix); + return new GroupMatchResult(groupEntries, currentRelativePath, contentRootSuffix, contentRootGroupName); } private void ApplyContentRootSuffix(ref StaticWebAsset asset, string contentRootSuffix, string groupName) From b2633beb422c179aee4b9005cfe015003a2fda78 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 17:47:12 +0100 Subject: [PATCH 10/20] Scope group definitions by SourceId so definitions only apply to matching assets --- .../Tasks/DefineStaticWebAssets.cs | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs index 6479132f32dd..375ba26365e3 100644 --- a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs @@ -84,7 +84,7 @@ public override bool Execute() _overrides = new HashSet(PropertyOverrides ?? [], StringComparer.OrdinalIgnoreCase); // Parse group definitions once upfront so they can be applied per-asset inside the loop. - List groupDefinitions = null; + Dictionary> groupDefinitions = null; if (StaticWebAssetGroupDefinitions != null && StaticWebAssetGroupDefinitions.Length > 0) { groupDefinitions = ParseGroupDefinitions(); @@ -92,7 +92,7 @@ public override bool Execute() { return false; // Validation error already logged } - Log.LogMessage(MessageImportance.Low, "Parsed {0} group definitions.", groupDefinitions.Count); + Log.LogMessage(MessageImportance.Low, "Parsed {0} group definition source(s).", groupDefinitions.Count); } var assetsCache = GetOrCreateAssetsCache(); @@ -628,9 +628,14 @@ private string GetDiscoveryCandidateMatchPath(ITaskItem candidate) private void ApplyGroupToAsset( ref StaticWebAsset asset, - List definitions, + Dictionary> definitionsBySourceId, StaticWebAssetGlobMatcher.MatchContext matchContext) { + if (!definitionsBySourceId.TryGetValue(asset.SourceId, out var definitions)) + { + return; + } + var result = MatchAssetToDefinitions(asset, definitions, matchContext); if (result.GroupEntries != null && result.GroupEntries.Count > 0) @@ -699,7 +704,7 @@ public GroupDefinition( public string ContentRootSuffix { get; } } - private List ParseGroupDefinitions() + private Dictionary> ParseGroupDefinitions() { var definitions = new List(); @@ -783,7 +788,18 @@ private List ParseGroupDefinitions() } definitions.Sort((a, b) => a.Order.CompareTo(b.Order)); - return definitions; + + var result = new Dictionary>(StringComparer.Ordinal); + foreach (var def in definitions) + { + if (!result.TryGetValue(def.SourceId, out var list)) + { + list = new List(); + result[def.SourceId] = list; + } + list.Add(def); + } + return result; } private GroupMatchResult MatchAssetToDefinitions( From 6c10eddab8b207ce5a660f0589597dcb37b299e9 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 17:48:38 +0100 Subject: [PATCH 11/20] Error on conflicting ContentRootSuffix values from multiple matching definitions --- src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs index 375ba26365e3..3535a28bd29f 100644 --- a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs @@ -881,6 +881,13 @@ private GroupMatchResult MatchAssetToDefinitions( if (!string.IsNullOrEmpty(def.ContentRootSuffix)) { + if (contentRootSuffix != null && !string.Equals(contentRootSuffix, def.ContentRootSuffix, StringComparison.Ordinal)) + { + Log.LogError( + "Asset '{0}' matched group definitions '{1}' and '{2}' with conflicting ContentRootSuffix values '{3}' and '{4}'.", + asset.Identity, contentRootGroupName, def.Name, contentRootSuffix, def.ContentRootSuffix); + return default; + } contentRootSuffix = def.ContentRootSuffix; contentRootGroupName = def.Name; } From 184fe9ef359f9495e260de0d23d48037bc3d5c4e Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 17:49:33 +0100 Subject: [PATCH 12/20] Validate required IntermediateOutputPath in ReadPackageAssetsManifest --- src/StaticWebAssetsSdk/Tasks/ReadPackageAssetsManifest.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/StaticWebAssetsSdk/Tasks/ReadPackageAssetsManifest.cs b/src/StaticWebAssetsSdk/Tasks/ReadPackageAssetsManifest.cs index ab9e0ed59adb..eede445e8e8b 100644 --- a/src/StaticWebAssetsSdk/Tasks/ReadPackageAssetsManifest.cs +++ b/src/StaticWebAssetsSdk/Tasks/ReadPackageAssetsManifest.cs @@ -33,6 +33,12 @@ public class ReadPackageAssetsManifest : Task public override bool Execute() { + if (string.IsNullOrEmpty(IntermediateOutputPath)) + { + Log.LogError("IntermediateOutputPath is required."); + return false; + } + var groupLookup = StaticWebAssetGroup.FromItemGroup(StaticWebAssetGroups); var allAssets = new List(); var allEndpoints = new List(); From 56fe2f316d49e82012cc1eba38fa942953f0de24 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 17:50:38 +0100 Subject: [PATCH 13/20] Error when endpoint AssetFile cannot be mapped to a package path --- .../Tasks/GeneratePackageAssetsManifestFile.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs b/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs index b4b4f28008d6..406af03f649c 100644 --- a/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs +++ b/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs @@ -51,6 +51,10 @@ public override bool Execute() } var manifestEndpoints = BuildManifestEndpoints(identityToPackagePath); + if (manifestEndpoints == null) + { + return false; + } var manifest = new StaticWebAssetPackageManifest { @@ -169,6 +173,14 @@ private StaticWebAssetEndpoint[] BuildManifestEndpoints(Dictionary Date: Tue, 17 Mar 2026 17:55:53 +0100 Subject: [PATCH 14/20] Add test coverage for validation errors, SourceId scoping, and ContentRootSuffix conflicts --- .../AssetGroupFilteringTest.cs | 160 ++++++++++++++++++ .../GeneratePackageAssetsManifestFileTest.cs | 26 +++ .../ReadPackageAssetsManifestTest.cs | 23 +++ 3 files changed, 209 insertions(+) diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs index a718a1f505c3..274259cbf4b4 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs @@ -310,6 +310,166 @@ public void ApplyGroupDefinitions_DifferentOrderSameSourceId_NoError() _errorMessages.Should().BeEmpty(); } + [Fact] + public void ApplyGroupDefinitions_MissingValue_ProducesError() + { + var file = CreateTempFile("wwwroot", "V4", "css", "site.css", "body{}"); + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + // No "Value" + ["Order"] = "0", + ["SourceId"] = "IdentityUI", + ["IncludePattern"] = "V4/**", + }) + }); + + var result = task.Execute(); + + result.Should().BeFalse(); + _errorMessages.Should().ContainSingle(m => m.Contains("missing required metadata 'Value'")); + } + + [Fact] + public void ApplyGroupDefinitions_MissingSourceId_ProducesError() + { + var file = CreateTempFile("wwwroot", "V4", "css", "site.css", "body{}"); + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "0", + // No "SourceId" + ["IncludePattern"] = "V4/**", + }) + }); + + var result = task.Execute(); + + result.Should().BeFalse(); + _errorMessages.Should().ContainSingle(m => m.Contains("missing required metadata 'SourceId'")); + } + + [Fact] + public void ApplyGroupDefinitions_InvalidOrder_ProducesError() + { + var file = CreateTempFile("wwwroot", "V4", "css", "site.css", "body{}"); + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "not-a-number", + ["SourceId"] = "IdentityUI", + ["IncludePattern"] = "V4/**", + }) + }); + + var result = task.Execute(); + + result.Should().BeFalse(); + _errorMessages.Should().ContainSingle(m => m.Contains("invalid or missing 'Order'")); + } + + [Fact] + public void ApplyGroupDefinitions_MissingIncludePattern_ProducesError() + { + var file = CreateTempFile("wwwroot", "V4", "css", "site.css", "body{}"); + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "0", + ["SourceId"] = "IdentityUI", + // No "IncludePattern" + }) + }); + + var result = task.Execute(); + + result.Should().BeFalse(); + _errorMessages.Should().ContainSingle(m => m.Contains("missing required metadata 'IncludePattern'")); + } + + [Fact] + public void ApplyGroupDefinitions_SourceIdMismatch_DefinitionsIgnored() + { + var file = CreateTempFile("wwwroot", "V4", "css", "site.css", "body-v4{}"); + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("BootstrapVersion", new Dictionary + { + ["Value"] = "V4", + ["Order"] = "0", + ["SourceId"] = "OtherLib", + ["IncludePattern"] = "V4/**", + ["RelativePathPattern"] = "V4/**", + ["ContentRootSuffix"] = "V4" + }) + }); + + var result = task.Execute(); + + result.Should().BeTrue(); + _errorMessages.Should().BeEmpty(); + task.Assets.Should().HaveCount(1); + + var asset = StaticWebAsset.FromTaskItem(task.Assets[0]); + asset.AssetGroups.Should().BeNullOrEmpty("definitions with mismatched SourceId should not apply"); + asset.RelativePath.Should().Contain("V4", "RelativePath should not be transformed"); + } + + [Fact] + public void ApplyGroupDefinitions_ConflictingContentRootSuffix_ProducesError() + { + var file = CreateTempFile("wwwroot", "shared", "site.css", "body{}"); + + var task = CreateDefineStaticWebAssetsTask( + new[] { CreateCandidateAssetItem(file) }, + new ITaskItem[] + { + new TaskItem("GroupA", new Dictionary + { + ["Value"] = "V1", + ["Order"] = "0", + ["SourceId"] = "IdentityUI", + ["IncludePattern"] = "**", + ["ContentRootSuffix"] = "suffixA" + }), + new TaskItem("GroupB", new Dictionary + { + ["Value"] = "V2", + ["Order"] = "1", + ["SourceId"] = "IdentityUI", + ["IncludePattern"] = "**", + ["ContentRootSuffix"] = "suffixB" + }) + }); + + var result = task.Execute(); + + result.Should().BeFalse(); + _errorMessages.Should().ContainSingle(m => m.Contains("conflicting ContentRootSuffix")); + } + [Theory] [InlineData(new[] { "BootstrapVersion=V4", "BootstrapVersion=V5" }, true)] [InlineData(new[] { "BootstrapVersion=V4", "" }, false)] diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsManifestFileTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsManifestFileTest.cs index 19422f019355..865bc966da63 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsManifestFileTest.cs +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/GeneratePackageAssetsManifestFileTest.cs @@ -180,6 +180,32 @@ public void AssetGroups_PreservedInManifest() manifest.Assets.Values.Single().AssetGroups.Should().Be("BootstrapVersion=V5"); } + [Fact] + public void Endpoints_UnmappedAssetFile_ProducesError() + { + var file = CreateTempFile("wwwroot", "js", "app.js", "var x;"); + var contentRoot = Path.Combine(_tempDir, "wwwroot") + Path.DirectorySeparatorChar; + + var asset = CreateAsset(file, contentRoot, "js/app.js", "abc"); + + var endpoint = new StaticWebAssetEndpoint + { + Route = "_content/mylib/js/missing.js", + AssetFile = Path.Combine(_tempDir, "nonexistent", "missing.js"), + Selectors = [], + ResponseHeaders = [], + EndpointProperties = [], + }; + + var task = CreateManifestTask( + new[] { asset.ToTaskItem() }, + StaticWebAssetEndpoint.ToTaskItems(new[] { endpoint })); + var result = task.Execute(); + + result.Should().BeFalse(); + _errorMessages.Should().ContainSingle(m => m.Contains("could not be mapped to a package-relative path")); + } + private GeneratePackageAssetsManifestFile CreateManifestTask( ITaskItem[] assets, ITaskItem[] endpoints = null, diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadPackageAssetsManifestTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadPackageAssetsManifestTest.cs index cc0043199a38..1bc26855d0a1 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadPackageAssetsManifestTest.cs +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/ReadPackageAssetsManifestTest.cs @@ -261,6 +261,29 @@ public void InvalidManifestVersion_LogsError() _errorMessages.Should().ContainSingle(m => m.Contains("Unsupported package manifest version")); } + [Fact] + public void MissingIntermediateOutputPath_ProducesError() + { + var packageRoot = SetupPackageRoot("MyLib", + CreateManifestAsset("staticwebassets/css/site.css", "css/site.css", "_content/mylib", "")); + var manifestItem = CreateManifestItem(packageRoot, "MyLib"); + + var task = new ReadPackageAssetsManifest + { + BuildEngine = _buildEngine.Object, + PackageManifests = new[] { manifestItem }, + StaticWebAssetGroups = Array.Empty(), + IntermediateOutputPath = null, + ProjectPackageId = "ConsumerApp", + ProjectBasePath = "_content/consumerapp", + }; + + var result = task.Execute(); + + result.Should().BeFalse(); + _errorMessages.Should().ContainSingle(m => m.Contains("IntermediateOutputPath is required")); + } + private ReadPackageAssetsManifest CreateReadManifestTask( ITaskItem[] manifests, ITaskItem[] groups = null) From 46368ea33a3b06ffc6d8f5e348ca9cb78703555b Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 17 Mar 2026 23:42:24 +0100 Subject: [PATCH 15/20] Add missing SourceId metadata to integration test group definitions --- .../AssetGroupsSample/IdentityUILib/IdentityUILib.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/IdentityUILib.csproj b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/IdentityUILib.csproj index 8aa4b18be7fc..0b90d526344a 100644 --- a/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/IdentityUILib.csproj +++ b/test/TestAssets/TestProjects/AssetGroupsSample/IdentityUILib/IdentityUILib.csproj @@ -20,8 +20,8 @@ - - + + From 06644e3d4267365e36db8fd4768fba532d8996cc Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Wed, 18 Mar 2026 11:09:00 +0100 Subject: [PATCH 16/20] Add missing SourceId metadata to deferred group test definition --- .../DeferredAssetGroupsIntegrationTest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/DeferredAssetGroupsIntegrationTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/DeferredAssetGroupsIntegrationTest.cs index da5bac6dd5e9..52cd072926b7 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/DeferredAssetGroupsIntegrationTest.cs +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/DeferredAssetGroupsIntegrationTest.cs @@ -101,6 +101,7 @@ private string BuildWithDeferredGroup(string enableBlazorGroup) new XAttribute("Include", "BlazorGroup"), new XAttribute("Value", "enabled"), new XAttribute("Order", "0"), + new XAttribute("SourceId", "ClassLibrary"), new XAttribute("IncludePattern", "deferred.blazor.js")))); document.Root.Add( new XElement("Import", From d82b779dd7414698bbd98d562f43eee8360f7a19 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Wed, 18 Mar 2026 19:11:34 +0100 Subject: [PATCH 17/20] Add TokenResolveMode enum, rename IsFileOnly to IsPackOnly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce TokenResolveMode (None/Pack/Serve) to control how token expressions are resolved during path computation. The ~ modifier now means 'pack-only' — the segment appears in physical NuGet package paths (Pack mode) but is stripped from HTTP routes and dev manifests (Serve mode). - Rename IsFileOnly to IsPackOnly on StaticWebAssetPathSegment - Rename PatternFileOnly to PatternPackOnly - Replace bool applyPreferences with TokenResolveMode resolveMode on StaticWebAssetPathPattern.ReplaceTokens() - Add resolveMode parameter to ComputeTargetPath and ReplaceTokens on StaticWebAsset, defaulting to Serve - Update all pack call sites to use TokenResolveMode.Pack: GenerateStaticWebAssetsPropsFile, GenerateStaticWebAssetEndpointsPropsFile, GeneratePackageAssetsManifestFile --- .../Tasks/Data/StaticWebAsset.cs | 8 +-- .../Tasks/Data/StaticWebAssetPathPattern.cs | 60 ++++++++++++------- .../Tasks/Data/StaticWebAssetPathSegment.cs | 4 +- .../GeneratePackageAssetsManifestFile.cs | 2 +- ...enerateStaticWebAssetEndpointsPropsFile.cs | 2 +- .../Tasks/GenerateStaticWebAssetsPropsFile.cs | 4 +- 6 files changed, 50 insertions(+), 30 deletions(-) diff --git a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs index 18fbae00c2d2..c03a4c3796fa 100644 --- a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs +++ b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAsset.cs @@ -1404,10 +1404,10 @@ private string CreatePathString(string pathPrefix, char separator) return pathWithTokens; } - public string ComputeTargetPath(string pathPrefix, char separator, StaticWebAssetTokenResolver providedTokens) + public string ComputeTargetPath(string pathPrefix, char separator, StaticWebAssetTokenResolver providedTokens, TokenResolveMode resolveMode = TokenResolveMode.Serve) { var pathWithTokens = CreatePathString(pathPrefix, separator); - return ReplaceTokens(pathWithTokens, providedTokens); + return ReplaceTokens(pathWithTokens, providedTokens, resolveMode); } // Tokens in static web assets represent a similar concept to tokens within routing. They can be used to identify logical @@ -1432,10 +1432,10 @@ public string ComputeTargetPath(string pathPrefix, char separator, StaticWebAsse // to be embedded in other contexts. // We might include other tokens in the future, like `[{basepath}]` to give a file the ability to have its path be relative to the consuming // project base path, etc. - public string ReplaceTokens(string pathWithTokens, StaticWebAssetTokenResolver tokens) + public string ReplaceTokens(string pathWithTokens, StaticWebAssetTokenResolver tokens, TokenResolveMode resolveMode = TokenResolveMode.Serve) { var pattern = StaticWebAssetPathPattern.Parse(pathWithTokens, Identity); - return pattern.ReplaceTokens(this, tokens, applyPreferences: true).Path; + return pattern.ReplaceTokens(this, tokens, resolveMode).Path; } public string ComputePathWithoutTokens(string pathWithTokens) diff --git a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs index 3e1b4cbd2ad6..cb12c14357d8 100644 --- a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs +++ b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs @@ -7,6 +7,19 @@ namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; +/// +/// Controls how token expressions are resolved during path computation. +/// +public enum TokenResolveMode +{ + /// No preferences applied — all segments included as-is. + None, + /// Skip optional non-preferred. Include and resolve pack-only (~) segments. Used for nupkg physical paths. + Pack, + /// Skip optional non-preferred. Strip pack-only (~) segments entirely. Used for routes, dev manifest, copy-to-output. + Serve +} + [DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0057:Use range operator", Justification = "Can't use range syntax in full framework")] #if WASM_TASKS @@ -19,7 +32,7 @@ public sealed class StaticWebAssetPathPattern : IEquatable rawPathMemory AddTokenSegmentParts(tokenExpression, token); pattern.Segments.Add(token); - // Check if the segment is optional (ends with ? or !) or file-only (ends with ~) + // Check if the segment is optional (ends with ? or !) or pack-only (ends with ~) if (tokenEnd < current.Length - 1 && - (current.Span[tokenEnd + 1] == PatternOptional || current.Span[tokenEnd + 1] == PatternPreferred || current.Span[tokenEnd + 1] == PatternFileOnly)) + (current.Span[tokenEnd + 1] == PatternOptional || current.Span[tokenEnd + 1] == PatternPreferred || current.Span[tokenEnd + 1] == PatternPackOnly)) { - if (current.Span[tokenEnd + 1] == PatternFileOnly) + if (current.Span[tokenEnd + 1] == PatternPackOnly) { token.IsOptional = true; token.IsPreferred = true; - token.IsFileOnly = true; + token.IsPackOnly = true; } else { @@ -220,14 +233,14 @@ public static StaticWebAssetPathPattern Parse(string rawPath, string assetIdenti // Values provided by the asset take precedence over values provided by the global resolvers. // Right now the only available value is the fingerprint value. // Global values in the future can include user defined tokens, like versions, etc. (For example, dotnet version, blazor web.js version, etc.) - // The applyPreferences parameter is used to determine if we should apply the preferences defined in the pattern, for example, if we should - // skip optional segments that are not preferred. - // Preferences are applied when we are generating file names for the final asset location on disk, in which case we need to reduce the expression - // to a single literal path. + // The resolveMode parameter controls how optional and pack-only segments are handled: + // - None: all segments included as-is. + // - Pack: skip optional non-preferred; include and resolve pack-only (~) segments. Used for nupkg paths. + // - Serve: skip optional non-preferred; strip pack-only (~) segments entirely. Used for routes, dev manifest, copy-to-output. #if WASM_TASKS - internal (string Path, Dictionary PatternValues) ReplaceTokens(StaticWebAsset staticWebAsset, StaticWebAssetTokenResolver tokens, bool applyPreferences = false) + internal (string Path, Dictionary PatternValues) ReplaceTokens(StaticWebAsset staticWebAsset, StaticWebAssetTokenResolver tokens, TokenResolveMode resolveMode = TokenResolveMode.None) #else - public (string Path, Dictionary PatternValues) ReplaceTokens(StaticWebAsset staticWebAsset, StaticWebAssetTokenResolver tokens, bool applyPreferences = false) + public (string Path, Dictionary PatternValues) ReplaceTokens(StaticWebAsset staticWebAsset, StaticWebAssetTokenResolver tokens, TokenResolveMode resolveMode = TokenResolveMode.None) #endif { var result = new StringBuilder(); @@ -240,8 +253,15 @@ public static StaticWebAssetPathPattern Parse(string rawPath, string assetIdenti } else { - if (applyPreferences && segment.IsOptional && !segment.IsPreferred) + if (resolveMode != TokenResolveMode.None && segment.IsOptional && !segment.IsPreferred) + { + // Skip optional non-preferred segments (e.g. ?) + continue; + } + + if (resolveMode == TokenResolveMode.Serve && segment.IsPackOnly) { + // Pack-only segments (~) are stripped in serve mode. continue; } @@ -333,20 +353,20 @@ public IEnumerable ExpandPatternExpression() // - other#[.{fingerprint}].js produces a single pattern asset#[.{fingerprint}].js // - last#[.{fingerprint}]?.txt produces two patterns last#[.{fingerprint}]?.txt and last.txt var hasOptionalSegments = false; - var hasFileOnlySegments = false; + var hasPackOnlySegments = false; foreach (var segment in Segments) { if (segment.IsOptional) { hasOptionalSegments = true; } - if (segment.IsFileOnly) + if (segment.IsPackOnly) { - hasFileOnlySegments = true; + hasPackOnlySegments = true; } } - if (!hasOptionalSegments && !hasFileOnlySegments) + if (!hasOptionalSegments && !hasPackOnlySegments) { return [this]; } @@ -355,9 +375,9 @@ public IEnumerable ExpandPatternExpression() for (var i = 0; i < Segments.Count; i++) { var segment = Segments[i]; - if (segment.IsFileOnly) + if (segment.IsPackOnly) { - // File-only segments (~) are never included in endpoint routes. + // Pack-only segments (~) are never included in endpoint routes. // Skip them entirely — don't fork, don't add. continue; } @@ -490,9 +510,9 @@ private static ReadOnlyMemory GetRawPattern(IList public bool IsPreferred { get; set; } - public bool IsFileOnly { get; set; } + public bool IsPackOnly { get; set; } public override bool Equals(object obj) => Equals(obj as StaticWebAssetPathSegment); @@ -53,7 +53,7 @@ internal string GetDebuggerDisplay() return Parts != null && Parts.Count == 1 && Parts[0].IsLiteral ? Parts[0].Name.ToString() : ComputeParameterExpression(); string ComputeParameterExpression() => - string.Concat(Parts.Select(p => p.IsLiteral ? p.Name.ToString() : $"{{{p.Name}}}").Prepend("#[").Append($"]{(IsFileOnly ? "~" : IsOptional ? (IsPreferred ? "!" : "?") : "")}")); + string.Concat(Parts.Select(p => p.IsLiteral ? p.Name.ToString() : $"{{{p.Name}}}").Prepend("#[").Append($"]{(IsPackOnly ? "~" : IsOptional ? (IsPreferred ? "!" : "?") : "")}")); } internal ICollection> GetTokenNames() diff --git a/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs b/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs index 406af03f649c..8d39deac3ff2 100644 --- a/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs +++ b/src/StaticWebAssetsSdk/Tasks/GeneratePackageAssetsManifestFile.cs @@ -93,7 +93,7 @@ private StaticWebAssetGlobMatcher CreateFrameworkMatcher() var packagePaths = new string[parsedAssets.Length]; for (var i = 0; i < parsedAssets.Length; i++) { - var packagePath = parsedAssets[i].ComputeTargetPath(PackagePathPrefix, '/', tokenResolver); + var packagePath = parsedAssets[i].ComputeTargetPath(PackagePathPrefix, '/', tokenResolver, TokenResolveMode.Pack); identityToPackagePath[parsedAssets[i].Identity] = packagePath; packagePaths[i] = packagePath; } diff --git a/src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetEndpointsPropsFile.cs b/src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetEndpointsPropsFile.cs index 071f42ac285d..db018e554773 100644 --- a/src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetEndpointsPropsFile.cs +++ b/src/StaticWebAssetsSdk/Tasks/GenerateStaticWebAssetEndpointsPropsFile.cs @@ -48,7 +48,7 @@ private bool ExecuteCore(StaticWebAssetEndpoint[] endpoints, Dictionary Date: Wed, 18 Mar 2026 21:07:29 +0100 Subject: [PATCH 18/20] Compose ContentRootSuffix across multiple group definitions When multiple group definitions with different names (e.g., version and theme) match the same asset, their ContentRootSuffix values now compose sequentially instead of erroring. Definitions are sorted by Order so composition is deterministic. For example, version=v4 (suffix 'v4') + theme=light (suffix 'light') produces 'OriginalRoot/v4/light'. Updated test to verify composition behavior. --- .../Tasks/DefineStaticWebAssets.cs | 15 +++++++++------ .../StaticWebAssets/AssetGroupFilteringTest.cs | 10 +++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs index 3535a28bd29f..f61cbadec59e 100644 --- a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs @@ -881,14 +881,17 @@ private GroupMatchResult MatchAssetToDefinitions( if (!string.IsNullOrEmpty(def.ContentRootSuffix)) { - if (contentRootSuffix != null && !string.Equals(contentRootSuffix, def.ContentRootSuffix, StringComparison.Ordinal)) + // Content root suffixes compose: version=v4 (suffix "v4") + theme=light (suffix "light") + // produces "OriginalRoot/v4/light". Definitions are sorted by Order so composition + // is deterministic. + if (contentRootSuffix != null) { - Log.LogError( - "Asset '{0}' matched group definitions '{1}' and '{2}' with conflicting ContentRootSuffix values '{3}' and '{4}'.", - asset.Identity, contentRootGroupName, def.Name, contentRootSuffix, def.ContentRootSuffix); - return default; + contentRootSuffix = contentRootSuffix.TrimEnd('/', '\\') + "/" + def.ContentRootSuffix.TrimStart('/', '\\'); + } + else + { + contentRootSuffix = def.ContentRootSuffix; } - contentRootSuffix = def.ContentRootSuffix; contentRootGroupName = def.Name; } } diff --git a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs index 274259cbf4b4..79a5f1f1a6c4 100644 --- a/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs +++ b/test/Microsoft.NET.Sdk.StaticWebAssets.Tests/StaticWebAssets/AssetGroupFilteringTest.cs @@ -438,7 +438,7 @@ public void ApplyGroupDefinitions_SourceIdMismatch_DefinitionsIgnored() } [Fact] - public void ApplyGroupDefinitions_ConflictingContentRootSuffix_ProducesError() + public void ApplyGroupDefinitions_MultipleContentRootSuffix_Compose() { var file = CreateTempFile("wwwroot", "shared", "site.css", "body{}"); @@ -466,8 +466,12 @@ public void ApplyGroupDefinitions_ConflictingContentRootSuffix_ProducesError() var result = task.Execute(); - result.Should().BeFalse(); - _errorMessages.Should().ContainSingle(m => m.Contains("conflicting ContentRootSuffix")); + result.Should().BeTrue(); + var asset = StaticWebAsset.FromTaskItem(task.Assets[0]); + asset.ContentRoot.Should().Contain("suffixA"); + asset.ContentRoot.Should().Contain("suffixB"); + // Suffixes compose in order: suffixA/suffixB + asset.ContentRoot.Should().Contain(Path.Combine("suffixA", "suffixB")); } [Theory] From 9146820f161343b932a6fecc4b7ff3574592e9f1 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Thu, 19 Mar 2026 10:11:09 +0100 Subject: [PATCH 19/20] Use Pack token resolve mode for nupkg target paths ComputeStaticWebAssetsTargetPaths was using TokenResolveMode.Serve (the default) when computing pack target paths, which strips pack-only (~) segments from relative paths. This caused group token expressions like #[{BootstrapVersion}]~/ to be stripped, resulting in nupkg entries like staticwebassets//css/site.css instead of staticwebassets/V4/css/site.css. Use TokenResolveMode.Pack when AdjustPathsForPack is true so pack-only segments are resolved rather than stripped. --- .../Tasks/ComputeStaticWebAssetsTargetPaths.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsTargetPaths.cs b/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsTargetPaths.cs index 80336ba3760b..b0023f3fe3ea 100644 --- a/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsTargetPaths.cs +++ b/src/StaticWebAssetsSdk/Tasks/ComputeStaticWebAssetsTargetPaths.cs @@ -29,6 +29,8 @@ public override bool Execute() AssetsWithTargetPath = new ITaskItem[Assets.Length]; var separator = UseAlternatePathDirectorySeparator ? Path.AltDirectorySeparatorChar : Path.DirectorySeparatorChar; + var resolveMode = AdjustPathsForPack ? TokenResolveMode.Pack : TokenResolveMode.Serve; + for (var i = 0; i < Assets.Length; i++) { var staticWebAsset = StaticWebAsset.FromTaskItem(Assets[i]); @@ -36,7 +38,7 @@ public override bool Execute() var targetPath = staticWebAsset.ComputeTargetPath( PathPrefix, - separator, StaticWebAssetTokenResolver.Instance); + separator, StaticWebAssetTokenResolver.Instance, resolveMode); if (AdjustPathsForPack && string.IsNullOrEmpty(Path.GetExtension(targetPath))) { From 876614f81ee91dd48c6b90d1c91aebc672e2c3df Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Mar 2026 11:24:59 +0000 Subject: [PATCH 20/20] Fix IsPreferred=false for pack-only tokens and remove redundant IncludeMatcher null-check Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com> Agent-Logs-Url: https://github.com/dotnet/sdk/sessions/c0028270-f89a-4a4f-b579-24b447712cd4 --- .../Tasks/Data/StaticWebAssetPathPattern.cs | 9 +++++---- src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs | 10 +++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs index cb12c14357d8..749744903916 100644 --- a/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs +++ b/src/StaticWebAssetsSdk/Tasks/Data/StaticWebAssetPathPattern.cs @@ -132,7 +132,7 @@ public static StaticWebAssetPathPattern Parse(ReadOnlyMemory rawPathMemory if (current.Span[tokenEnd + 1] == PatternPackOnly) { token.IsOptional = true; - token.IsPreferred = true; + token.IsPreferred = false; token.IsPackOnly = true; } else @@ -253,15 +253,16 @@ public static StaticWebAssetPathPattern Parse(string rawPath, string assetIdenti } else { - if (resolveMode != TokenResolveMode.None && segment.IsOptional && !segment.IsPreferred) + if (resolveMode != TokenResolveMode.None && segment.IsOptional && !segment.IsPreferred && !segment.IsPackOnly) { - // Skip optional non-preferred segments (e.g. ?) + // Skip optional non-preferred segments (e.g. ?), but never pack-only segments here — + // they are included in Pack mode and stripped by the explicit check below in Serve mode. continue; } if (resolveMode == TokenResolveMode.Serve && segment.IsPackOnly) { - // Pack-only segments (~) are stripped in serve mode. + // Pack-only segments (~) are stripped in serve mode (routes, dev manifest, copy-to-output). continue; } diff --git a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs index f61cbadec59e..924d6764755a 100644 --- a/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs +++ b/src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssets.cs @@ -743,13 +743,9 @@ private Dictionary> ParseGroupDefinitions() var relativePathPrefix = def.GetMetadata("RelativePathPrefix"); var contentRootSuffix = def.GetMetadata("ContentRootSuffix"); - StaticWebAssetGlobMatcher includeMatcher = null; - if (!string.IsNullOrEmpty(includePattern)) - { - includeMatcher = new StaticWebAssetGlobMatcherBuilder() - .AddIncludePatterns(includePattern.Split(GroupPatternSeparator, StringSplitOptions.RemoveEmptyEntries)) - .Build(); - } + var includeMatcher = new StaticWebAssetGlobMatcherBuilder() + .AddIncludePatterns(includePattern.Split(GroupPatternSeparator, StringSplitOptions.RemoveEmptyEntries)) + .Build(); StaticWebAssetGlobMatcher excludeMatcher = null; if (!string.IsNullOrEmpty(excludePattern))