67 writes to AssetFile
Microsoft.NET.Sdk.BlazorWebAssembly.Tests (3)
StaticWebAssetsBaselineFactory.cs (3)
86endpoint.AssetFile = asset.Identity; 99endpoint.AssetFile = asset.Identity; 180endpoint.AssetFile = TemplatizeFilePath(
Microsoft.NET.Sdk.StaticWebAssets.Tasks (4)
ApplyCompressionNegotiation.cs (1)
274AssetFile = compressedAsset.Identity,
Data\StaticWebAssetEndpoint.cs (1)
470AssetFile = metadataValue;
DefineStaticWebAssetEndpoints.cs (1)
192AssetFile = asset.Identity,
GenerateStaticWebAssetEndpointsManifest.cs (1)
116endpoint.AssetFile = asset.ResolvedAsset.ComputeTargetPath("", '/', StaticWebAssetTokenResolver.Instance);
Microsoft.NET.Sdk.StaticWebAssets.Tests (60)
StaticWebAssets\ApplyCompressionNegotiationTest.cs (47)
80AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 94AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 107AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 192AssetFile = Path.Combine(AppContext.BaseDirectory, $"{expectedName}.br"), 258AssetFile = Path.Combine(AppContext.BaseDirectory, $"{expectedName}.gz"), 324AssetFile = Path.Combine(AppContext.BaseDirectory, "wwwroot", "candidate.js"), 377AssetFile = Path.Combine(AppContext.BaseDirectory, $"{expectedName}.br"), 435AssetFile = Path.Combine(AppContext.BaseDirectory, $"{expectedName}.gz"), 493AssetFile = Path.Combine(AppContext.BaseDirectory, $"{expectedName}.br"), 549AssetFile = Path.Combine(AppContext.BaseDirectory, $"{expectedName}.gz"), 605AssetFile = Path.Combine(AppContext.BaseDirectory, "wwwroot", "candidate.js"), 648AssetFile = Path.Combine(AppContext.BaseDirectory, $"{expectedName}.br"), 696AssetFile = Path.Combine(AppContext.BaseDirectory, $"{expectedName}.gz"), 806AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 819AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 831AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 844AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 856AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 911AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 924AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 935AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 948AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 959AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 982AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 995AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 1007AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 1020AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 1032AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 1103AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 1116AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 1127AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 1140AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 1151AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 1164AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.br")), 1185AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 1198AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.br")), 1211AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 1223AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 1236AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.br")), 1249AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 1261AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 1274AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.br")), 1369AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 1383AssetFile = Path.GetFullPath(Path.Combine("wwwroot", "candidate.js")), 1396AssetFile = Path.GetFullPath(Path.Combine("compressed", "candidate.js.gz")), 1410AssetFile = Path.GetFullPath(Path.Combine("publish", "candidate.js")), 1491AssetFile = Path.GetFullPath(assetFile),
StaticWebAssets\ComputeEndpointsForReferenceStaticWebAssetsTest.cs (1)
140AssetFile = Path.GetFullPath(assetFile),
StaticWebAssets\DefineStaticWebAssetEndpointsTest.cs (1)
647AssetFile = Path.GetFullPath(assetFile),
StaticWebAssets\GenerateStaticWebAssetEndpointsManifestTest.cs (4)
23AssetFile = "index.html", 66AssetFile = "index.fingerprint.js", 109AssetFile = "index.html", 142AssetFile = "index.fingerprint.js",
StaticWebAssets\GenerateStaticWebAssetEndpointsPropsFileTest.cs (1)
211AssetFile = Path.GetFullPath(assetFile),
StaticWebAssets\GenerateStaticWebAssetsManifestTest.cs (1)
115AssetFile = asset.Identity,
StaticWebAssets\ResolveFingerprintedStaticWebAssetEndpointsForAssetsTest.cs (1)
210endpoints[0].AssetFile = Path.GetFullPath("other.js");
StaticWebAssets\UpdateStaticWebAssetEndpointsTest.cs (1)
253AssetFile = fingerprintedEndpoints[0].AssetFile + ".gz",
StaticWebAssetsBaselineFactory.cs (3)
86endpoint.AssetFile = asset.Identity; 99endpoint.AssetFile = asset.Identity; 180endpoint.AssetFile = TemplatizeFilePath(
108 references to AssetFile
Microsoft.NET.Sdk.BlazorWebAssembly.Tests (16)
StaticWebAssetsBaselineComparer.cs (14)
84.ThenBy(a => a.AssetFile) 97{string.Join($"{Environment.NewLine} ", foundDuplicateEndpoints.Select(a => @$"{a.Key.Route} - {a.Key.AssetFile} - {a.Key.Selectors.Length} - {a.Value.Length}"))}{Environment.NewLine}"); 101actualAssetsByIdentity.Should().ContainKey(endpoint.AssetFile); 106.ThenBy(a => a.AssetFile) 353For {expectedAsset.AssetFile}: 405string.Join($"{Environment.NewLine}\t", expectedEndpoints.Select(a => $"{a.Route} - {a.Selectors.Length} - {a.AssetFile}")), 407string.Join($"{Environment.NewLine}\t", manifestEndpoints.Select(a => $"{a.Route} - {a.Selectors.Length} - {a.AssetFile}")) 413{string.Join($"{Environment.NewLine}\t", missingEndpoints.Select(a => $"{a.Route} - {a.AssetFile}"))}"); 419{string.Join($"{Environment.NewLine}\t", unexpectedEndpoints.Select(a => $"{a.Route} - {a.AssetFile}"))}"); 439if (manifestAsset.AssetFile != expectedAsset.AssetFile) 441assetDifferences.Add($"Expected manifest SourceType of {expectedAsset.AssetFile} but found {manifestAsset.AssetFile}."); 506return Path.GetExtension(asset.AssetFile.TrimEnd(']'));
StaticWebAssetsBaselineFactory.cs (2)
79var endpointsByAssetFile = manifest.Endpoints.GroupBy(e => e.AssetFile).ToDictionary(g => g.Key, g => g.ToArray()); 181endpoint.AssetFile,
Microsoft.NET.Sdk.StaticWebAssets.Tasks (49)
ApplyCompressionNegotiation.cs (3)
115if (endpointsByAsset.TryGetValue(endpoint.AssetFile, out var endpointsToSkip)) 122endpointsByAsset.Remove(endpoint.AssetFile); 139Log.LogMessage(MessageImportance.Low, " Adding endpoint '{0}'", endpoint.AssetFile);
ComputeEndpointsForReferenceStaticWebAssets.cs (3)
30if (assets.TryGetValue(candidateEndpoint.AssetFile, out var asset)) 59Log.LogMessage(MessageImportance.Low, "Adding endpoint {0} for asset {1} with updated route {2}.", candidateEndpoint.Route, candidateEndpoint.AssetFile, candidateEndpoint.Route); 66Log.LogMessage(MessageImportance.Low, "Skipping endpoint {0} because the asset {1} was not found.", candidateEndpoint.Route, candidateEndpoint.AssetFile);
Data\StaticWebAssetEndpoint.cs (21)
52_assetFile ??= _originalItem?.GetMetadata(nameof(AssetFile)); 157var assetFile = endpoint.AssetFile; 1840 => string.Compare(a.AssetFile, b.AssetFile, StringComparison.Ordinal), 233AssetFile == other.AssetFile && 260hashCode.Add(AssetFile); 278$"{nameof(StaticWebAssetEndpoint)}: Route = {Route}, AssetFile = {AssetFile}, Selectors = {StaticWebAssetEndpointSelector.ToMetadataValue(Selectors ?? [])}, ResponseHeaders = {ResponseHeaders?.Length}, EndpointProperties = {StaticWebAssetEndpointProperty.ToMetadataValue(EndpointProperties ?? [])}"; 288var assetFileComparison = StringComparer.Ordinal.Compare(AssetFile, other.AssetFile); 401string.Equals(x.AssetFile, y.AssetFile, StringComparison.Ordinal); 412return HashCode.Combine(obj.Route, obj.AssetFile); 423nameof(AssetFile), 456nameof(AssetFile) => AssetFile ?? "", 469case nameof(AssetFile): 499{ nameof(AssetFile), AssetFile ?? "" }, 524destinationItem.SetMetadata(nameof(AssetFile), AssetFile ?? "");
DefineStaticWebAssetEndpoints.cs (1)
79var assetFile = endpointCandidate.GetMetadata(nameof(StaticWebAssetEndpoint.AssetFile));
FilterStaticWebAssetEndpoints.cs (1)
44if (assetFiles.Count > 0 && !assetFiles.TryGetValue(endpoint.AssetFile, out asset))
GenerateStaticWebAssetEndpointsManifest.cs (3)
85if (!manifestAssets.TryGetValue(endpoint.AssetFile, out var asset)) 87Log.LogMessage(MessageImportance.Low, "Skipping endpoint '{0}' because the asset '{1}' is not part of the manifest", endpoint.Route, endpoint.AssetFile); 119Log.LogMessage(MessageImportance.Low, "Including endpoint '{0}' for asset '{1}' with final location '{2}'", endpoint.Route, endpoint.AssetFile, asset.TargetPath);
GenerateStaticWebAssetEndpointsPropsFile.cs (5)
46.ThenBy(e => e.AssetFile, StringComparer.OrdinalIgnoreCase); 50var asset = assets[element.AssetFile]; 56new XElement(nameof(StaticWebAssetEndpoint.AssetFile), fullPathExpression), 127if (!asset.ContainsKey(endpoint.AssetFile)) 129Log.LogError($"The asset file '{endpoint.AssetFile}' specified in the endpoint '{endpoint.Route}' does not exist.");
GenerateStaticWebAssetsManifest.cs (5)
530 => string.CompareOrdinal(l.AssetFile, r.AssetFile), 107if (assetsByIdentity.ContainsKey(endpoint.AssetFile)) 110Log.LogMessage(MessageImportance.Low, $"Accepted endpoint: Route='{endpoint.Route}', AssetFile='{endpoint.AssetFile}'"); 114Log.LogMessage(MessageImportance.Low, $"Filtered out endpoint: Endpoint='{endpoint.Route}' AssetFile='{endpoint.AssetFile}'");
OverrideHtmlAssetPlaceholders.cs (3)
48var endpoints = StaticWebAssetEndpoint.FromItemGroup(Endpoints).Where(e => e.AssetFile.EndsWith(".js") || e.AssetFile.EndsWith(".mjs")); 220var asset = Assets.FirstOrDefault(a => a.ItemSpec == endpoint.AssetFile);
ResolveFingerprintedStaticWebAssetEndpointsForAssets.cs (1)
32var endpointsByAsset = candidateEndpoints.GroupBy(e => e.AssetFile, OSPath.PathComparer)
ResolveStaticWebAssetEndpointRoutes.cs (2)
25if (!assets.TryGetValue(endpoint.AssetFile, out var asset)) 27Log.LogError($"The asset file '{endpoint.AssetFile}' for endpoint '{endpoint.Route}' was not found.");
UpdateExternallyDefinedStaticWebAssets.cs (1)
42.GroupBy(e => e.AssetFile, OSPath.PathComparer)
Microsoft.NET.Sdk.StaticWebAssets.Tests (43)
StaticWebAssetEndpointsIntegrationTest.cs (7)
199var file = new FileInfo(endpoint.AssetFile); 337var publishAsset = publishManifest.Assets.Where(a => a.Identity == unCompressedAssetEndpoint.Single().AssetFile); 345var publishGzAsset = publishManifest.Assets.Where(a => a.Identity == appGzAssetEndpoint.Single().AssetFile); 354var publishBrAsset = publishManifest.Assets.Where(a => a.Identity == appBrAssetEndpoint.Single().AssetFile); 523var endpointsByAssetFile = endpoints.Endpoints.GroupBy(e => e.AssetFile).ToDictionary(g => g.Key, g => g.ToArray()); 527wwwrootFolderFiles.Should().Contain(endpoint.AssetFile); 528foundAssets.Add(endpoint.AssetFile);
StaticWebAssets\ApplyCompressionNegotiationTest.cs (3)
1560var compressedEndpoint = endpoints.FirstOrDefault(e => e.Route == "candidate.js" && e.AssetFile.Contains("candidate.js.gz")); 1627var compressedEndpoint = endpoints.FirstOrDefault(e => e.Route == "candidate.js" && e.AssetFile.Contains("candidate.js.gz")); 1694var compressedEndpoint = endpoints.FirstOrDefault(e => e.Route == "candidate.js" && e.AssetFile.Contains("candidate.js.gz"));
StaticWebAssets\DefineStaticWebAssetEndpointsTest.cs (6)
58endpoint.AssetFile.Should().Be(Path.GetFullPath(Path.Combine("wwwroot", "candidate.js"))); 126endpoint.AssetFile.Should().Be(Path.GetFullPath(Path.Combine("wwwroot", "candidate.js"))); 175otherEndpoint.AssetFile.Should().Be(Path.GetFullPath(Path.Combine("wwwroot", "candidate.js"))); 243endpoint.AssetFile.Should().Be(Path.GetFullPath(Path.Combine("wwwroot", "candidate.js"))); 292otherEndpoint.AssetFile.Should().Be(Path.GetFullPath(Path.Combine("wwwroot", "candidate.js"))); 537endpoint.AssetFile.Should().Be(assetIdentity);
StaticWebAssets\ReadStaticWebAssetsManifestFileTest.cs (1)
198endpoint.GetMetadata(nameof(StaticWebAssetEndpoint.AssetFile)).Should().BeEquivalentTo($"{identity}");
StaticWebAssets\UpdateStaticWebAssetEndpointsTest.cs (3)
253AssetFile = fingerprintedEndpoints[0].AssetFile + ".gz", 284var updatedUnmodifiedEndpoint = updatedEndpoints.Where(e => e.AssetFile.EndsWith(".gz")); 287var updatedModifiedEndpoints = updatedEndpoints.Where(e => !e.AssetFile.EndsWith(".gz"));
StaticWebAssetsBaselineComparer.cs (14)
84.ThenBy(a => a.AssetFile) 97{string.Join($"{Environment.NewLine} ", foundDuplicateEndpoints.Select(a => @$"{a.Key.Route} - {a.Key.AssetFile} - {a.Key.Selectors.Length} - {a.Value.Length}"))}{Environment.NewLine}"); 101actualAssetsByIdentity.Should().ContainKey(endpoint.AssetFile); 106.ThenBy(a => a.AssetFile) 353For {expectedAsset.AssetFile}: 405string.Join($"{Environment.NewLine}\t", expectedEndpoints.Select(a => $"{a.Route} - {a.Selectors.Length} - {a.AssetFile}")), 407string.Join($"{Environment.NewLine}\t", manifestEndpoints.Select(a => $"{a.Route} - {a.Selectors.Length} - {a.AssetFile}")) 413{string.Join($"{Environment.NewLine}\t", missingEndpoints.Select(a => $"{a.Route} - {a.AssetFile}"))}"); 419{string.Join($"{Environment.NewLine}\t", unexpectedEndpoints.Select(a => $"{a.Route} - {a.AssetFile}"))}"); 439if (manifestAsset.AssetFile != expectedAsset.AssetFile) 441assetDifferences.Add($"Expected manifest SourceType of {expectedAsset.AssetFile} but found {manifestAsset.AssetFile}."); 506return Path.GetExtension(asset.AssetFile.TrimEnd(']'));
StaticWebAssetsBaselineFactory.cs (2)
79var endpointsByAssetFile = manifest.Endpoints.GroupBy(e => e.AssetFile).ToDictionary(g => g.Key, g => g.ToArray()); 181endpoint.AssetFile,
StaticWebAssetsCompressionIntegrationTest.cs (6)
60var standardEndpoints = manifest2.Endpoints.Where(e => string.Equals(e.AssetFile, file, StringComparison.Ordinal)).ToArray(); 61var gzipEndpoints = manifest2.Endpoints.Where(e => string.Equals(e.AssetFile, gzipFile, StringComparison.Ordinal)).ToArray(); 62var brotliEndpoints = manifest2.Endpoints.Where(e => string.Equals(e.AssetFile, brotliFile, StringComparison.Ordinal)).ToArray(); 172var standardEndpoints = manifest2.Endpoints.Where(e => string.Equals(e.AssetFile, file, StringComparison.Ordinal)).ToArray(); 173var gzipEndpoints = manifest2.Endpoints.Where(e => string.Equals(e.AssetFile, gzipFile, StringComparison.Ordinal)).ToArray(); 174var brotliEndpoints = manifest2.Endpoints.Where(e => string.Equals(e.AssetFile, brotliFile, StringComparison.Ordinal)).ToArray();
StaticWebAssetsFingerprintingTest.cs (1)
176=> endpoints.Endpoints.FirstOrDefault(e => e.Route == route && e.Selectors.Length == 0)?.AssetFile ?? throw new Exception($"Missing endpoint for file '{route}' in '{endpointsManifestPath}'");