13 implementations of Name
Aspire.Hosting (1)
ApplicationModel\Resource.cs (1)
17public virtual string Name { get; }
Aspire.Hosting.Azure.EventHubs (1)
AzureEventHubsEmulatorResource.cs (1)
24public override string Name => _innerResource.Name;
Aspire.Hosting.Azure.PostgreSQL (1)
AzurePostgresResource.cs (1)
31public override string Name => _innerResource.Name;
Aspire.Hosting.Azure.Redis (1)
AzureRedisResource.cs (1)
31public override string Name => _innerResource.Name;
Aspire.Hosting.Azure.Storage (1)
AzureStorageEmulatorResource.cs (1)
17public override string Name => _innerResource.Name;
Aspire.Hosting.CodeGeneration.Python.Tests (2)
AtsPythonCodeGeneratorTests.cs (2)
1271public string Name => nameof(CollidingAlphaResource); 1278public string Name => nameof(CollidingBetaResource);
Aspire.Hosting.Tests (4)
DistributedApplicationBuilderTests.cs (1)
1435public string Name => nameof(TestResource);
DistributedApplicationModelExtensionsTests.cs (1)
73public string Name { get; set; } = "CustomResource";
Eventing\DistributedApplicationBuilderEventingTests.cs (1)
533public string Name { get; } = name;
Utils\VolumeNameGeneratorTests.cs (1)
49public string Name { get; } = name;
Aspire.Hosting.Yarp.Tests (2)
AddYarpTests.cs (1)
480public string Name => name;
YarpClusterTests.cs (1)
323public string Name => name;
1220 references to Name
Aspire.Hosting (357)
ApplicationModel\CertificateTrustExecutionConfigurationGatherer.cs (2)
82resourceLogger.LogInformation("No custom certificate authorities to configure for '{ResourceName}'. Default certificate authority trust behavior will be used.", resource.Name); 126resourceLogger.LogInformation("Resource '{ResourceName}' has a certificate trust scope of '{Scope}'. Automatically including system root certificates in the trusted configuration.", resource.Name, Enum.GetName(additionalData.Scope));
ApplicationModel\CommandsConfigurationExtensions.cs (3)
205return new ExecuteCommandResult { Success = false, Message = string.Format(CultureInfo.InvariantCulture, CommandStrings.RebuilderResourceNotFound, projectResource.Name) }; 354return await FinishAsync(new ExecuteCommandResult { Success = true, Message = string.Format(CultureInfo.InvariantCulture, CommandStrings.ResourceRebuilt, projectResource.Name) }).ConfigureAwait(false); 403if (string.Equals(resource.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName) &&
ApplicationModel\ConnectionStringReference.cs (1)
83internal void ThrowConnectionStringUnavailableException() => throw new DistributedApplicationException($"The connection string for the resource '{Resource.Name}' is not available.");
ApplicationModel\ContainerImageReference.cs (2)
33public string ValueExpression => $"{{{Resource.Name}.containerImage}}"; 69var imageName = buildOptionsContext.LocalImageName ?? Resource.Name.ToLowerInvariant();
ApplicationModel\ContainerPortReference.cs (1)
20public string ValueExpression => $"{{{Resource.Name}.containerPort}}";
ApplicationModel\CustomResourceSnapshot.cs (2)
570relationships.Add(new(resourceWithParent.Parent.Name, KnownRelationshipTypes.Parent)); 575relationships.Add(new(annotation.Resource.Name, annotation.Type));
ApplicationModel\DebugSupportExtensions.cs (3)
175$"The launch configuration callback context belongs to resource '{context.Resource.Name}', " + 176$"but launch configuration was requested for resource '{resource.Name}'.", 183$"Resource '{resource.Name}' does not declare debug launch support. " +
ApplicationModel\Docker\ContainerFilesExtensions.cs (4)
36logger?.LogWarning("Cannot get container image name for source resource {SourceName}, skipping", source.Name); 94logger?.LogWarning("Cannot get container image name for source resource {SourceName}, skipping", source.Name); 120private static string GetSourceImageArgName(IResource source) => $"{source.Name.Replace("-", "_").ToUpperInvariant()}_IMAGENAME"; 123private static string GetSourceStageName(IResource source) => $"{source.Name.Replace("-", "_")}_stage";
ApplicationModel\DotnetProgramPublishing.cs (6)
49Name = $"build-{stepResource.Name}", 50Description = $"Builds the container image for the {stepResource.Name} project.", 63Name = $"push-{stepResource.Name}", 77context.LocalImageName = context.Resource.Name.ToLowerInvariant(); 110$"The .NET program resource '{resource.Name}' cannot use PublishWithContainerFiles with a prebuilt container image. " + 126$"The build environment of .NET program resource '{resource.Name}' changed after the publish pipeline was resolved.");
ApplicationModel\EndpointReference.cs (4)
37return $"The endpoint `{EndpointName}` is not defined for the resource `{Resource.Name}`. The resource has no endpoints defined."; 41return $"The endpoint `{EndpointName}` is not defined for the resource `{Resource.Name}`. Available endpoints: {formattedNames}."; 151string Binding(string prop) => $"{{{Resource.Name}.bindings.{EndpointName}.{prop}}}"; 222?? throw new InvalidOperationException($"The endpoint `{EndpointName}` is not allocated for the resource `{Resource.Name}`.");
ApplicationModel\ExecutableLaunchRecipe.cs (3)
381$"Resource '{context.Resource.Name}' declares \"{debugSupport.LaunchConfigurationType}\" debug launch support (WithDebugSupport) but has no project metadata. " + 416$"Failed to produce launch configuration type '{debugSupport.LaunchConfigurationType}' for resource '{context.Resource.Name}'.", 562context.Resource.Name);
ApplicationModel\ExecutionConfigurationGathererContext.cs (2)
74resourceLogger.LogError(ex, "Failed to resolve environment variable '{EnvironmentVariable}' for resource '{ResourceName}'. A dependency may have failed to start.", kvp.Key, resource.Name); 123resourceLogger.LogError(ex, "Failed to resolve argument for resource '{ResourceName}'. A dependency may have failed to start.", resource.Name);
ApplicationModel\IResourceCollection.cs (1)
26if (string.Equals(item.Name, name, StringComparisons.ResourceName))
ApplicationModel\IResourceWithConnectionString.cs (1)
19string IManifestExpressionProvider.ValueExpression => $"{{{Name}.connectionString}}";
ApplicationModel\ProjectLaunchConfigurationFactory.cs (1)
19$"Resource '{resource.Name}' cannot produce a \"{KnownLaunchConfigurationTypes.Project}\" launch configuration because it has no project metadata. " +
ApplicationModel\ProjectLaunchDefaultsAnnotation.cs (1)
64$"Resource '{resource.Name}' project metadata was replaced after project defaults were applied. " +
ApplicationModel\ProjectResourceExtensions.cs (2)
86throw new InvalidOperationException($"Resource '{projectResource.Name}' does not carry an {nameof(IProjectMetadata)} annotation."); 101$"Resource '{projectResource.Name}' carries more than one {nameof(IProjectMetadata)} annotation. " +
ApplicationModel\RequiredCommandValidator.cs (5)
58throw new InvalidOperationException($"Required command on resource '{resource.Name}' cannot be null or empty."); 71_logger.LogWarning("Resource '{ResourceName}' may fail to start: {Message}", resource.Name, state.ErrorMessage); 78_logger.LogDebug("Required command '{Command}' for resource '{ResourceName}' already validated, resolved to '{ResolvedPath}'.", command, resource.Name, state.ResolvedPath); 118_logger.LogWarning("{Message}", string.Format(CultureInfo.CurrentCulture, MessageStrings.ResourceMayFailToStart, resource.Name, message)); 147_logger.LogDebug("Required command '{Command}' for resource '{ResourceName}' resolved to '{ResolvedPath}'.", command, resource.Name, resolved);
ApplicationModel\ResourceCollection.cs (14)
23if (!_resourcesByName.TryAdd(resource.Name, resource)) 25ThrowDuplicateResource(resource, _resourcesByName[resource.Name]); 40if (!StringComparers.ResourceName.Equals(old.Name, value.Name) && 41_resourcesByName.TryGetValue(value.Name, out var existing)) 47_resourcesByName.Remove(old.Name); 48_resourcesByName[value.Name] = value; 57if (!_resourcesByName.TryAdd(item.Name, item)) 59ThrowDuplicateResource(item, _resourcesByName[item.Name]); 78if (!_resourcesByName.TryAdd(item.Name, item)) 80ThrowDuplicateResource(item, _resourcesByName[item.Name]); 90_resourcesByName.Remove(item.Name); 101_resourcesByName.Remove(item.Name); 120throw new DistributedApplicationException($"Cannot add resource of type '{newResource.GetType()}' with name '{newResource.Name}' because resource of type '{existingResource.GetType()}' with that name already exists. Resource names are case-insensitive.");
ApplicationModel\ResourceExtensions.cs (19)
668logger.LogInformation("Waiting for value from resource '{ResourceName}'", providerResource.Name); 672logger.LogInformation("Waiting for value for environment variable value '{Name}' from resource '{ResourceName}'", key, providerResource.Name); 677logger.LogInformation("Waiting for value for connection string from resource '{ResourceName}'", cs.Name); 684endpointReference.Resource.Name, 1090var computeEnvironmentNames = string.Join(", ", annotations.Select(a => a.ComputeEnvironment?.Name)); 1091throw new InvalidOperationException($"Resource '{resource.Name}' has multiple compute environments - '{computeEnvironmentNames}'. Please specify a single compute environment using 'WithComputeEnvironment'."); 1126throw new InvalidOperationException($"A circular lifetime reference was detected for resource '{resource.Name}'."); 1137: throw new InvalidOperationException($"Resource '{resource.Name}' has a resource persistence mode but no source resource."), 1187throw new InvalidOperationException($"A circular lifetime reference was detected for resource '{resource.Name}'."); 1199throw new InvalidOperationException($"Resource '{resource.Name}' has a parent process persistence mode but no parent process identity."); 1203: throw new InvalidOperationException($"Resource '{resource.Name}' has a resource persistence mode but no source resource."); 1266throw new InvalidOperationException($"Resource '{resource.Name}' has no resolved names."); 1270throw new InvalidOperationException($"Resource '{resource.Name}' has multiple resolved names: {string.Join(", ", names)}."); 1283return resource.GetReplicaCount() > 1 ? resourceId : resource.Name; 1317return [resource.Name]; 1334RemoteImageName = resource.Name.ToLowerInvariant(), 1394var registryNames = string.Join(", ", registryTargetAnnotations.Select(a => a.Registry is IResource res ? res.Name : a.Registry.ToString())); 1396$"Resource '{resource.Name}' has multiple container registries available - '{registryNames}'. " + 1400throw new InvalidOperationException($"Resource '{resource.Name}' does not have a container registry reference.");
ApplicationModel\ResourceNotificationService.cs (21)
161dependency.Name, 171dependency.Name, 252if (appModel is not null && !appModel.Resources.Any(r => string.Equals(r.Name, resourceName, StringComparisons.ResourceName))) 336resourceLogger.LogInformation("Waiting for resource '{ResourceName}' to complete.", dependency.Name); 340var displayName = names.Length > 1 ? names[i] : dependency.Name; 357dependency.Name, 371throw new DistributedApplicationException($"Resource '{resource.Name}' stopped waiting for dependency resource '{displayName}' because it failed to start."); 384$"Resource '{resource.Name}' stopped waiting for dependency resource '{displayName}' because it entered the '{snapshot.State.Text}' state with exit code '{snapshot.ExitCode}', expected '{exitCode}'." 405resourceLogger.LogInformation("Waiting for resource '{ResourceName}' to enter the '{State}' state.", dependency.Name, KnownResourceStates.Running); 412var displayName = names.Length > 1 ? names[i] : dependency.Name; 421dependency.Name, 437throw new DistributedApplicationException($"Resource '{resource.Name}' stopped waiting for dependency resource '{displayName}' because it failed to start."); 450$"Resource '{resource.Name}' stopped waiting for dependency resource '{displayName}' because it entered the '{snapshot.State.Text}' state prematurely." 614$"Resource '{resource.Name}' failed to wait for dependencies before the operation was cancelled.", 615resource.Name); 713if (!string.Equals(resourceName, resourceEvent.Resource.Name, StringComparisons.ResourceName)) 772foreach (var matchingResource in _resourceNotificationStates.Where(s => string.Equals(s.Value.Resource.Name, resourceId, StringComparisons.ResourceName))) 912_logger.LogTrace("Resource {ResourceName}/{ResourceId} update skipped because the snapshot is unchanged.", resource.Name, resourceId); 933_logger.LogDebug("Resource {ResourceName}/{ResourceId} changed state: {PreviousState} -> {NewState}", resource.Name, resourceId, previousStateText, newStateText); 938_logger.LogDebug("Resource {ResourceName}/{ResourceId} changed state: {NewState}", resource.Name, resourceId, newStateText); 962resource.Name,
ApplicationModel\ResourceTerminalCatalog.cs (2)
89Id: BuildId(resource.Name, host.ParentReplicaIndex), 90ResourceName: resource.Name,
ApplicationModel\VolumeMountBindingAnnotation.cs (3)
84$"Volume '{VolumeName}' on resource '{context.Resource.Name}' does not declare a mount path."); 144$"Resource '{context.Resource.Name}' binds volume '{VolumeName}' to environment variable " + 145$"'{EnvironmentVariableName}', but compute environment '{environment.Name}' does not support volume " +
Ats\CoreExports.cs (1)
179return resource.Resource.Name;
Ats\ModelExports.cs (1)
52return model.Resources.SingleOrDefault(resource => StringComparers.ResourceName.Equals(resource.Name, name));
Ats\NotificationExports.cs (1)
153ResourceName = resourceEvent.Resource.Name,
Backchannel\AppHostRpcTarget.cs (4)
129if (string.Equals(resourceEvent.Resource.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)) 137logger.LogTrace("Resource {ResourceName} does not have endpoints.", resourceEvent.Resource.Name); 151Resource = resourceEvent.Resource.Name, 341ResourceName = step.Resource?.Name
Backchannel\AuxiliaryBackchannelRpcTarget.cs (11)
440var resource = appModel.Resources.FirstOrDefault(r => string.Equals(r.Name, request.ResourceName, StringComparisons.ResourceName)); 606resource.Name, 612ResourceName = resource.Name, 613DisplayName = resource.Name, 808var matchingResource = appModel.Resources.SingleOrDefault(resource => string.Equals(resource.Name, requestedResourceName, StringComparisons.ResourceName)); 829resolvedMatches[0].ResolvedResourceNames.Length == 1 ? resolvedMatches[0].Resource.Name : requestedResourceName, 844? matchingResource.Resource.Name 853|| (ResourceName is not null && string.Equals(resourceEvent.Resource.Name, ResourceName, StringComparisons.ResourceName)); 1210DisplayName = resource.Name, 1810.FirstOrDefault(r => string.Equals(r.Name, resourceName, StringComparisons.ResourceName)); 2011if (string.Equals(resource.Name, resourceName, StringComparisons.ResourceName))
Backchannel\DashboardUrlsHelper.cs (1)
39r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)) as IResourceWithEndpoints;
BuiltInDistributedApplicationEventSubscriptionHandlers.cs (2)
46if (beforeStartEvent.Model.Resources.SingleOrDefault(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)) is { } dashboardResource) 101logger.LogWarning(MessageStrings.PersistentContainerWithoutUserSecrets, resource.Name);
ConnectionStringBuilderExtensions.cs (2)
62if (resourceNames.Add(resource.Name)) 72if (resourceNames.Add(innerRef.Name))
ContainerResourceBuilderExtensions.cs (4)
696context.LocalImageName = dockerfileAnnotation.ImageName ?? context.Resource.Name; 701context.LocalImageName = context.Resource.Name; 849context.LocalImageName = dockerfileAnnotation.ImageName ?? context.Resource.Name; 854context.LocalImageName = context.Resource.Name;
Dashboard\DashboardEventHandlers.cs (3)
57if (@event.Model.Resources.SingleOrDefault(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)) is { } dashboardResource) 712.Where(r => !string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)) 760if (string.Equals(notification.Resource.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName) && !dashboardResourceTasks.ContainsKey(notification.ResourceId))
Dashboard\DashboardServiceData.cs (2)
77DisplayName = resource.Name, 112logger.LogError(ex, "Error updating resource snapshot for {Name}", @event.Resource.Name);
Dcp\ContainerCreator.cs (8)
110_ => throw new InvalidOperationException($"Unknown pull policy '{Enum.GetName(typeof(ImagePullPolicy), pullPolicy)}' for container '{container.Name}'") 114ctr.Annotate(CustomResource.ResourceNameAnnotation, container.Name); 115ctr.Annotate(CustomResource.OtelServiceNameAnnotation, container.Name); 131.Prepend($"{container.Name}.dev.internal") 132.Prepend(container.Name) 230throw new FailedToApplyEnvironmentException($"Failed to apply configuration to container {cr.ModelResource.Name}", configuration.Exception); 290modelContainer.Name); 600_logger.LogDebug(ex, "Failed to apply argument value '{ArgKey}' to '{ResourceName}'. A dependency may have failed to start.", a, modelResource.Name);
Dcp\ContainerNetworkEndpointProvisioner.cs (9)
143if (IsContainerTunnelContainerName(container.Name)) 145throw new DistributedApplicationException($"Container resource name '{container.Name}' conflicts with the Aspire container tunnel container name '{ContainerTunnelContainerName}'. Rename the resource or disable the Aspire container tunnel."); 151throw new DistributedApplicationException($"Container resource '{container.Name}' uses container name '{containerNameAnnotation.Name}', which conflicts with the Aspire container tunnel container name '{ContainerTunnelContainerName}'. Rename the container or disable the Aspire container tunnel."); 158throw new DistributedApplicationException($"Container resource '{container.Name}' uses network alias '{aliasAnnotation.Alias}', which conflicts with the Aspire container tunnel container name '{ContainerTunnelContainerName}'. Rename the alias or disable the Aspire container tunnel."); 189StringComparers.ResourceName.Equals(serviceWithResource.ModelResource.Name, hostResource.Resource.Name) && 193throw new InvalidDataException($"Host endpoint '{endpoint.Name}' on resource '{hostResource.Resource.Name}' should have an associated DCP Service resource already set up"); 209service.Annotate(CustomResource.ResourceNameAnnotation, hostResource.Resource.Name); 254hostResource.Resource.Name,
Dcp\DcpExecutor.cs (15)
679_logger.LogWarning("Encountered the same service-endpoint combination more than once for {EndpointName} on resource {ResourceName} when creating default endpoint services. This should never happen.", endpoint.Name, sp.ModelResource.Name); 708svc.Annotate(CustomResource.ResourceNameAnnotation, sp.ModelResource.Name); 847_logger.LogDebug("Using persisted public port {Port} for proxyless endpoint '{EndpointName}' on persistent resource '{ResourceName}'.", persistedPort, endpoint.Name, resource.Name); 852_logger.LogDebug("Allocated public port {Port} for proxyless endpoint '{EndpointName}' on resource '{ResourceName}'.", publicPort, endpoint.Name, resource.Name); 859_logger.LogWarning("Failed to persist public port {Port} for proxyless endpoint '{EndpointName}' on persistent resource '{ResourceName}'. Enable user secrets, set a fixed public port, or configure the endpoint to use a proxy to avoid recreating the persistent resource each run.", publicPort, endpoint.Name, resource.Name); 901_logger.LogDebug("Ignoring invalid persisted public port value '{Port}' for proxyless endpoint '{EndpointName}' on persistent resource '{ResourceName}'.", configuredPort, endpoint.Name, resource.Name); 909return $"Resources:{resource.Name}:{endpoint.Name}:port"; 1055resourceLogger.LogError(ex, "Failed to create resource {ResourceName}", modelResource.Name); 1097resourceLogger.LogError(ex, "Failed to create resource {ResourceName}", er.ModelResource.Name); 1120throw new DistributedApplicationException($"Couldn't find required {nameof(DcpInstancesAnnotation)} annotation on resource {resource.Name}."); 1131throw new DistributedApplicationException($"Couldn't find required instance ID for index {instanceIndex} on resource {resource.Name}."); 1304_logger.LogError(ex, "Failed to start resource {ResourceName}", resourceReference.ModelResource.Name); 1410_connectionStringsAdvertised.Remove(resource.Name); 1418if (!_endpointsAdvertised.Add(resource.Name)) 1438if (!_connectionStringsAdvertised.Add(resource.Name))
Dcp\DcpModelUtilities.cs (5)
33var modelResourceName = modelResource.Name ?? "(unknown)"; 57var modelResourceName = modelResource.Name ?? "(unknown)"; 242$"{sp.ModelResource.Name}.dev.internal", 296string.Equals(ts.ResourceName, res.Name, StringComparisons.ResourceName) && 315string.Equals(swr.ModelResource.Name, ts.ResourceName, StringComparisons.ResourceName) &&
Dcp\DcpNameGenerator.cs (3)
85throw new InvalidOperationException($"Resource '{resource.Name}' uses multiple replicas and a persistent lifetime. These features do not work together."); 187return maybeWithSuffix(resource.Name, suffix, options.ResourceNameSuffix); 191=> $"{resource.Name}|{endpoint.Name}|{targetNetworkId.Value}";
Dcp\DcpResourceWatcher.cs (5)
132_resourceState = new(model.Resources.ToDictionary(r => r.Name), appResources.Get()); 339_logger.LogTrace("Deleting application model resource {AppResourceName} with {ResourceKind} resource {DcpResourceName}", appModelResource.Name, resourceKind, resource.Metadata.Name); 346_logger.LogTrace("Updating application model resource {AppResourceName} with {ResourceKind} resource {DcpResourceName}", appModelResource.Name, resourceKind, resource.Metadata.Name); 956StringComparers.ResourceName.Equals(e.Resource.Name, endpointOwnerResourceName) && 966StringComparers.ResourceName.Equals(reference.ModelResource.Name, resourceName))
Dcp\ExecutableCreator.cs (13)
71$"Failed to apply configuration to executable {renderedResource.ModelResource.Name}", 99$"Failed to apply launch configuration for resource '{renderedResource.ModelResource.Name}'. " + 109$"Failed to create executable launch plan for resource '{renderedResource.ModelResource.Name}'. " + 150$"Resource '{resource.Name}' references endpoint '{endpointReference.EndpointName}' on executable resource " + 151$"'{endpointReference.Resource.Name}' using the default Aspire container network, but the application does not contain any container resources."); 157$"Resource '{resource.Name}' references endpoint '{endpointReference.EndpointName}' on executable resource " + 158$"'{endpointReference.Resource.Name}' using the default Aspire container network, but the Aspire container tunnel only supports TCP endpoints."); 206$"Resource '{resource.Name}' must have exactly one executable launch recipe, but {recipes.Length} were found."); 223$"The executable launch recipe for resource '{resource.Name}' returned a {plan.Mechanism} plan after {decision.Mechanism} was selected."); 229$"The executable launch recipe for resource '{resource.Name}' selected IDE execution without producing a launch configuration."); 342executable.Annotate(CustomResource.OtelServiceNameAnnotation, resource.Name); 344executable.Annotate(CustomResource.ResourceNameAnnotation, resource.Name); 402resource.Name);
Dcp\ResourceSnapshotBuilder.cs (3)
312&& u.Endpoint?.Resource.Name == appModelResource.Name) 341var endpointOwnerResourceName = endpointUrl.Endpoint!.Resource.Name;
Devcontainers\DevcontainerPortForwardingEventingSubscriber.cs (1)
47$"{@event.Resource.Name}-{endpoint.Name}");
Diagnostics\ProfilingTelemetry.cs (4)
424var activity = StartActivity(configuration, $"{Activities.ResourceStartup} {resource.Name}", ActivityKind.Internal, startTime); 997SetTag(Tags.ResourceWaitDependencyName, dependency.Name); 1019SetTag(Tags.ResourceName, resource.Name); 1101[Tags.ResourceName] = resourceEvent.Resource.Name,
DistributedApplication.cs (1)
849var value = $@"Type = {Resource.GetType().Name}, Name = ""{Resource.Name}"", State = {Snapshot?.State?.Text ?? "(null)"}";
DistributedApplicationBuilder.cs (3)
717missingResourceHealthCheck.Resource.Name); 892foreach (var duplicateResourceName in Resources.GroupBy(r => r.Name, StringComparers.ResourceName) 1125ModelName.ValidateName(nameof(Aspire.Hosting.ApplicationModel.Resource), resource.Name, policy.MaxLength, policy.ValidateStartsWithLetter, policy.ValidateAllowedCharacters, policy.ValidateNoConsecutiveHyphens, policy.ValidateNoTrailingHyphen);
DistributedApplicationBuilderExtensions.cs (2)
67var resource = builder.Resources.FirstOrDefault(r => string.Equals(r.Name, name, StringComparison.OrdinalIgnoreCase)); 100var resource = builder.Resources.FirstOrDefault(r => string.Equals(r.Name, name, StringComparison.OrdinalIgnoreCase));
DotnetProgramResourceBuilderExtensions.cs (1)
123$"Resource '{builder.Resource.Name}' must implement {nameof(IComputeResource)} to use .NET SDK publishing.");
Health\ResourceHealthCheckService.cs (13)
31var resourceName = resourceEvent.Resource.Name; 127logger.LogDebug("Resource '{ResourceName}' has no health checks to monitor.", resource.Name); 134logger.LogDebug("Resource '{ResourceName}' health checks to monitor: {HeathCheckKeys}", resource.Name, string.Join(", ", registrationKeysToCheck)); 173logger.LogTrace("Health report status for '{ResourceName}' is {HealthReportStatus}.", resource.Name, report.Status); 193logger.LogTrace("Health reports for '{ResourceName}' have changed.", resource.Name); 216resource.Name 228logger.LogTrace("Resource '{ResourceName}' health check monitoring loop starting delay of {DelayInterval}.", resource.Name, delayInterval); 257logger.LogDebug("Resource '{ResourceName}' is ready.", resource.Name); 264logger.LogDebug("Publishing ResourceReadyEvent for '{ResourceName}'.", resource.Name); 269logger.LogDebug("Waiting for ResourceReadyEvent for '{ResourceName}'.", resource.Name); 274logger.LogDebug("ResourceReadyEvent for '{ResourceName}' completed.", resource.Name); 276logger.LogDebug("Publishing the result of ResourceReadyEvent for '{ResourceName}'.", resource.Name); 333_resourceName = initialEvent.Resource.Name;
Lifecycle\DotnetBuildCommandEventingSubscriber.cs (2)
112resource.Name == CoordinatedBuildResourceName || 113resource.Name.StartsWith($"{CoordinatedBuildResourceName}-", StringComparison.Ordinal);
Lifecycle\TerminalHostEventingSubscriber.cs (3)
75host.Parent.Name, host.ParentReplicaIndex); 84host.Parent.Name, host.ParentReplicaIndex); 107host.Parent.Name,
Lifecycle\TerminalHostFailureDiagnosticService.cs (1)
127host.Parent.Name,
McpServerResourceBuilderExtensions.cs (2)
63$"Could not create MCP server for resource '{resource.Name}' as no endpoint was found with name '{endpointName}'."); 80$"Could not create MCP server for resource '{resource.Name}' as no endpoint was found matching one of the specified names: {string.Join(", ", s_httpSchemes)}");
Orchestrator\ApplicationOrchestrator.cs (21)
100_logger.LogWarning(ex, "Failed to resolve connection property {ConnectionPropertyName} for resource {ResourceName}.", property.Key, resourceWithConnectionString.Name); 154@event.Resource.Name, 324_logger.LogTrace("Setting primary launch profile endpoint to '{EndpointName}' for resource '{ResourceName}'.", endpoint.Name, resource.Name); 390Url = $"{allocatedEndpoint.UriScheme}://{resource.Name.ToLowerInvariant()}-{subdomainSuffix}.dev.localhost:{allocatedEndpoint.Port}", 416_logger.LogTrace("Added URL '{Url}' for endpoint '{EndpointName}' on resource '{ResourceName}'.", url.Url, endpoint.Name, resource.Name); 423_logger.LogTrace("Added additional URL '{Url}' for endpoint '{EndpointName}' on resource '{ResourceName}'.", additionalUrl.Url, endpoint.Name, resource.Name); 437_logger.LogTrace("Added static URL '{Url}' for resource '{ResourceName}'.", staticUrl.Url, resource.Name); 450_logger.LogTrace("Running {CallbackCount} URL callbacks for resource '{ResourceName}'.", callbacks.Count(), resource.Name); 461_logger.LogTrace("Invoking URL callback '{CallbackIndex}' for resource '{ResourceName}'.", index, resource.Name); 466_logger.LogTrace("{UrlCount} URLs after callback '{CallbackIndex}' for resource '{ResourceName}'.", urlsCallbackContext.Urls.Count, index, resource.Name); 472_logger.LogTrace("{UrlCount} URLs after calling '{CallbackIndex}' callback(s) for resource '{ResourceName}'.", urls.Count, index, resource.Name); 492_logger.LogTrace("Applying path '{Path}' from URL '{Url}' for primary launch profile endpoint '{EndpointName}' to other launch profile endpoints for resource '{ResourceName}'.", primaryPath, primaryUrl.Url, primaryLaunchProfileEndpoint.Name, resource.Name); 502_logger.LogTrace("Updating URL '{Url}' with path '{Path}' for launch profile endpoint '{EndpointName}' for resource '{ResourceName}'.", url.Url, primaryPath, url.Endpoint.EndpointName, resource.Name); 508_logger.LogTrace("Updated URL to '{Url}' for launch profile endpoint '{EndpointName}' on resource '{ResourceName}'.", url.Url, url.Endpoint.EndpointName, resource.Name); 517_logger.LogTrace("URL '{Url}' for primary launch profile endpoint '{EndpointName}' for resource '{ResourceName}' does not have a path to apply to other launch profile endpoints.", primaryUrl.Url, primaryLaunchProfileEndpoint.Name, resource.Name); 525_logger.LogTrace("Could not find URL for primary launch profile endpoint '{EndpointName}' for resource '{ResourceName}'.", primaryLaunchProfileEndpoint.Name, resource.Name); 533_logger.LogTrace("Converting relative endpoint URLs to absolute URLs for resource '{ResourceName}'.", resource.Name); 544_logger.LogTrace("Converted relative URL to absolute URL '{Url}' for endpoint '{EndpointName}' on resource '{ResourceName}'.", url.Url, endpoint.EndpointName, resource.Name); 558_logger.LogTrace("Added URL annotation '{Url}' to resource '{ResourceName}'.", url.Url, resource.Name); 563_logger.LogTrace("Added total of {UrlCount} URLs to resource '{ResourceName}'", count, resource.Name); 569resourceLogger.LogError(ex, "An error occurred while processing URLs for resource '{ResourceName}': {Message}", resource.Name, ex.Message);
ParameterResourceBuilderExtensions.cs (1)
417var parameter = new ParameterResource(builder.Resource.Name, _ => "", secret: true);
Pipelines\DistributedApplicationPipeline.cs (12)
208$"Resource '{resource.Name}' has Destination set to Archive but OutputPath is not configured. " + 234var registryNames = string.Join(", ", registryTargetAnnotations.Select(a => a.Registry is IResource res ? res.Name : a.Registry.ToString())); 236$"Resource '{resource.Name}' requires image push but has multiple container registries available - '{registryNames}'. " + 244$"Resource '{resource.Name}' requires image push but no container registry is available. " + 359var resourceNames = string.Join("', '", unboundResources.Select(resource => resource.Name)); 360var environmentNames = string.Join("', '", computeEnvironments.Select(environment => environment.Name)); 388if (!string.Equals(resource.Name, annotation.Source.Name, StringComparison.OrdinalIgnoreCase)) 390consumedBuildOnlyContainerNames.Add(annotation.Source.Name); 396.Where(resource => !consumedBuildOnlyContainerNames.Contains(resource.Name)) 401var resourceNames = string.Join("', '", unconsumedBuildOnlyContainers.Select(resource => resource.Name)); 1196sb.AppendLine(CultureInfo.InvariantCulture, $" Resource: {step.Resource.Name} ({step.Resource.GetType().Name})");
Pipelines\PipelineOutputService.cs (2)
76return Path.Combine(baseOutputDir, resource.Name); 91return Path.Combine(baseTempDir, resource.Name);
Pipelines\PipelineStepHelpers.cs (10)
42resource.Name, buildOptionsContext.Destination); 68new MarkdownString($"Tagging **{resource.Name}** for local use"), 77throw new InvalidOperationException($"Failed to get target tag for {resource.Name}"); 83: resource.Name.ToLowerInvariant(); 90new MarkdownString($"Successfully tagged **{resource.Name}** as `{targetTag}`"), 97new MarkdownString($"Failed to tag **{resource.Name}**: {ex.Message}"), 114new MarkdownString($"Pushing **{resource.Name}** to **{registryName}**"), 123throw new InvalidOperationException($"Failed to get target tag for {resource.Name}"); 130new MarkdownString($"Successfully pushed **{resource.Name}** to `{targetTag}`"), 137new MarkdownString($"Failed to push **{resource.Name}**: {ex.Message}"),
ProjectResourceBuilderExtensions.cs (3)
521$"Project defaults have already been applied to resource '{builder.Resource.Name}'. " + 572if (!string.Equals(builder.Resource.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)) 1101var rebuilderName = $"{projectResource.Name}-rebuilder";
Publishing\ContainerRuntimeBase.cs (1)
83: resource.Name.ToLowerInvariant();
Publishing\ManifestPublishingContext.cs (8)
87_manifestResourceNames.Add(resource.Name); 135$"The .NET program resource '{resource.Name}' is not configured for publishing. " + 157Writer.WriteStartObject(resource.Name); 187throw new DistributedApplicationException($"Project metadata was not found for resource '{project.Name}'."); 242Writer.WriteStartObject(source.Name); 693if (_referencedResources.TryAdd(resource.Name, resource)) 695_manifestResourceNames.Add(resource.Name); 928_referencedResources.Remove(existingResource.Name);
Publishing\ResourceContainerImageManager.cs (17)
277LocalImageName = resource.Name, 354resource.Name); 382logger.LogInformation("Building container image for resource {ResourceName}", resource.Name); 405throw new InvalidOperationException($"The container image name for resource '{resource.Name}' could not be determined."); 417throw new NotSupportedException($"The resource '{resource.Name}' of type '{resource.GetType().Name}' is not supported."); 433logger.LogInformation("Building container image for resource {ResourceName}", resource.Name); 439$"Resource '{resource.Name}' has Destination set to Archive but OutputPath is not configured. " + 456logger.LogInformation("Building image: {ResourceName}", resource.Name); 498logger.LogInformation("Building image for {ResourceName} completed", resource.Name); 522logger.LogError(ex, "Building image for {ResourceName} failed", resource.Name); 650$"Failed to build container image for resource '{resource.Name}' from project '{projectMetadata.ProjectPath}' with exit code {processResult.ExitCode}."; 725$"An execution context is required to evaluate the build environment for resource '{resource.Name}'."); 747$"The build environment variable '{name}' for .NET program resource '{resource.Name}' " + 775$"The build environment property '{propertyName}' for .NET program resource '{resource.Name}' " + 941logger.LogInformation("Building image: {ResourceName}", resource.Name); 997logger.LogInformation("Building image for {ResourceName} completed", resource.Name); 1001logger.LogError(ex, "Failed to build container image from Dockerfile for {ResourceName}", resource.Name);
ResourceBuilderExtensions.cs (40)
151throw new InvalidOperationException($"Resource '{builder.Resource.Name}' does not support lifetime configuration."); 223throw new InvalidOperationException($"Resource '{builder.Resource.Name}' does not support lifetime configuration."); 463throw new DistributedApplicationException($"The URL parameter '{externalService.Resource.UrlParameter.Name}' for source resource '{externalService.Resource.Name}' is invalid while configuring target resource '{builder.Resource.Name}': {message}"); 788?? throw new InvalidOperationException($"Resource '{resource.Name}' does not contain an annotation with ID '{annotationId}'."); 873?? throw new InvalidOperationException($"Annotation '{definition.Id}' on resource '{resource.Name}' deserialized to null."); 897?? throw new InvalidOperationException($"Annotation '{definition.Id}' on resource '{resource.Name}' deserialized to null."); 1059var serviceName = name ?? annotation.Resource.Name; 1269throw new InvalidOperationException($"The resource '{source.Resource.Name}' can't be used with withReference because it doesn't provide a connection string, service discovery, or a custom withReference implementation."); 1370connectionName ??= resource.Name; 1447$"'{candidateNames.LogicalName}' on resource '{context.Resource.Name}' both use " + 1577throw new InvalidOperationException($"The URI for service reference '{name}' is invalid while configuring target resource '{builder.Resource.Name}': it must be absolute."); 1582throw new InvalidOperationException($"The URI for service reference '{name}' is invalid while configuring target resource '{builder.Resource.Name}': it cannot contain a fragment."); 1587throw new InvalidOperationException($"The URI for service reference '{name}' is invalid while configuring target resource '{builder.Resource.Name}': it cannot contain a query string."); 1664throw new DistributedApplicationException($"The URL parameter '{externalService.Resource.UrlParameter.Name}' for source resource '{externalService.Resource.Name}' is invalid while configuring target resource '{builder.Resource.Name}': {message}"); 2516context.Logger.LogWarning("Could not execute callback to customize endpoint URL as no endpoint with name '{EndpointName}' could be found on resource '{ResourceName}'.", endpointName, builder.Resource.Name); 2562context.Logger.LogWarning("Could not execute callback to add an endpoint URL as no endpoint with name '{EndpointName}' could be found on resource '{ResourceName}'.", endpointName, builder.Resource.Name); 2604context.Logger.LogWarning("Could not execute callback to customize endpoint URL as no URL for endpoint '{EndpointName}' could be found on resource '{ResourceName}'.", endpoint.EndpointName, builder.Resource.Name); 2616context.Logger.LogWarning("Could not execute callback to add an endpoint URL as no endpoint with name '{EndpointName}' could be found on resource '{ResourceName}'.", endpoint.EndpointName, endpoint.Resource.Name); 2807throw new DistributedApplicationException($"The '{builder.Resource.Name}' resource cannot wait for itself."); 2812throw new DistributedApplicationException($"The '{builder.Resource.Name}' resource cannot wait for its parent '{dependency.Resource.Name}'."); 2930throw new DistributedApplicationException($"The '{builder.Resource.Name}' resource cannot wait for itself."); 2935throw new DistributedApplicationException($"The '{builder.Resource.Name}' resource cannot wait for its parent '{dependency.Resource.Name}'."); 3033throw new DistributedApplicationException($"The '{builder.Resource.Name}' resource cannot wait for itself."); 3038throw new DistributedApplicationException($"The '{builder.Resource.Name}' resource cannot wait for its parent '{dependency.Resource.Name}'."); 3093throw new DistributedApplicationException($"Resource '{builder.Resource.Name}' already has a health check with key '{key}'."); 3180?? throw new DistributedApplicationException($"Could not create HTTP health check for resource '{builder.Resource.Name}' as the endpoint selector returned null."); 3184throw new DistributedApplicationException($"Could not create HTTP health check for resource '{builder.Resource.Name}' as the endpoint with name '{endpoint.EndpointName}' and scheme '{endpoint.Scheme}' is not an HTTP endpoint."); 3197throw new DistributedApplicationException($"The endpoint '{endpointName}' does not exist on the resource '{builder.Resource.Name}'."); 3203var healthCheckKey = $"{builder.Resource.Name}_{endpointName}_{path}_{statusCode}_check"; 4055?? throw new DistributedApplicationException($"Could not create HTTP command for resource '{builder.Resource.Name}' as the endpoint selector returned null."); 4059throw new DistributedApplicationException($"Could not create HTTP command for resource '{builder.Resource.Name}' as the endpoint with name '{endpoint.EndpointName}' and scheme '{endpoint.Scheme}' is not an HTTP endpoint."); 4067commandName ??= $"{endpoint.Resource.Name}-{endpoint.EndpointName}-http-{commandOptions.Method.Method.ToLowerInvariant()}-{path}"; 4790throw new DistributedApplicationException($"Could not create {errorDisplayNoun} for resource '{builder.Resource.Name}' as the endpoint with name '{matchingEndpoint.EndpointName}' and scheme '{matchingEndpoint.Scheme}' is not an HTTP endpoint."); 4798throw new DistributedApplicationException($"Could not create {errorDisplayNoun} for resource '{builder.Resource.Name}' as no endpoint was found matching one of the specified names: {endpointNamesString}"); 4818throw new DistributedApplicationException($"Could not create HTTP command for resource '{builder.Resource.Name}' as it has no HTTP endpoints."); 5423builder.Resource.Name, 5563var endpoint = endpointSelector() ?? throw new DistributedApplicationException($"Could not create HTTP probe for resource '{builder.Resource.Name}' as the endpoint selector returned null.");
ResourceLoggerForwarderService.cs (1)
66var logger = loggerFactory.CreateLogger($"{applicationName}.Resources.{resource.Name}");
src\Shared\LaunchProfiles\LaunchProfileExtensions.cs (1)
30return projectMetadata.GetLaunchSettings(projectResource.Name);
src\Shared\ResourceNameComparer.cs (3)
17return x.Name.Equals(y.Name, StringComparison.Ordinal); 21obj?.Name.GetHashCode(StringComparison.Ordinal) ?? 0;
src\Shared\VolumeMountPathResolver.cs (1)
34GetStablePathSegment(resource.Name),
TerminalResourceBuilderExtensions.cs (3)
82$"Resource '{builder.Resource.Name}' already has a terminal configured. Call WithTerminal() only once per resource."); 194var terminalHostName = $"{parent.Name}-terminalhost-{i.ToString(CultureInfo.InvariantCulture)}"; 230ResourceName = parent.Name,
Utils\DockerfileHelper.cs (1)
49resource.Name,
Utils\ImageNameGenerator.cs (1)
18return builder.Resource.Name.ToLowerInvariant();
VolumeNameGenerator.cs (1)
33var resourceName = builder.Resource.Name;
VolumeResourceBuilderExtensions.cs (1)
82$"Resource '{builder.Resource.Name}' does not support environment variables and cannot use the '{env}' volume path variable.");
Aspire.Hosting.Azure (42)
AzureEnvironmentResourceExtensions.cs (1)
149while (builder.Resources.Any(resource => StringComparers.ResourceName.Equals(resource.Name, name)))
AzureProvisioningController.cs (30)
1145.Select(static resource => resource.Resource.Name) 1283string.Equals(resource.Resource.Name, resourceName, StringComparisons.ResourceName) || 1284string.Equals(resource.AzureResource.Name, resourceName, StringComparisons.ResourceName)); 1341if (visitedResources.Add(resource.Resource.Name)) 1430activeOperation.Operation.ResourceNames.Contains(resource.Resource.Name) || 1431activeOperation.Operation.ResourceNames.Contains(resource.AzureResource.Name)).ToList(); 1874loggerService.GetLogger(model.Resources.Single(item => item.Name == resource.ResourceName)) 1929var outputs = ParseDeploymentStateJson(resource.Name, "Outputs", section.Data["Outputs"]?.GetValue<string>()); 1937remainingResources.Add(new RemainingNonArmResource(resource.Name, resourceType, GetOutput(outputName), tenantId)); 1941remainingResources.Add(new RemainingNonArmResource(resource.Name, resource.GetType().Name, null, tenantId)); 2293driftedResources.Add(resource.Resource.Name); 2387? [resource.Resource.Name] 2388: new[] { resource.Resource.Name, resource.AzureResource.Name }) 2911=> resource.AzureResource is AzureBicepResource bicepResource ? bicepResource.Name : resource.Resource.Name; 2953var resourceName = requiredDeploymentResourceName ?? (targetResources.Count == 1 ? targetResources.Single().Resource.Name : string.Join(", ", targetResources.Select(static resource => resource.Resource.Name))); 3506if (!notificationService.TryGetCurrentState(resource.Name, out var resourceEvent)) 3746resource is not AzureEnvironmentResource && !activeOperation.AffectsResource(resource.Name)) 3797if (seenNames.Add(resource.Name)) 3924if (TryGetPublishedTerminalDeploymentState(resource.Resource.Name, out var publishedTerminalState) || 3938if (!IsResourceInState(resource.Resource.Name, CancelingState) && 4057resourceLogger.LogInformation("Skipping {resourceName} because it is not a Bicep resource.", resource.AzureResource.Name); 4066resourceLogger.LogInformation("Skipping {resourceName} because it is not configured to be provisioned.", resource.AzureResource.Name); 4078resourceLogger.LogWarning("Cached Azure deployment state for {resourceName} points to a missing Azure resource. Reprovisioning.", resource.AzureResource.Name); 4094resourceLogger.LogInformation("Using connection information stored in user secrets for {resourceName}.", resource.AzureResource.Name); 4101resourceLogger.LogInformation("Resolving {resourceName} as existing resource...", resource.AzureResource.Name); 4105resourceLogger.LogInformation("Provisioning {resourceName}...", resource.AzureResource.Name); 4142resourceLogger.LogError(ex, "Error provisioning {ResourceName}.", resource.AzureResource.Name); 4143FailProvisioning(resource.AzureResource, new InvalidOperationException($"Unable to provision {resource.AzureResource.Name}.", ex));
AzurePublishingContext.cs (5)
464var resourceDockerfilePath = Path.Combine(outputPath, $"{resource.Name}.Dockerfile"); 469$"Processing deployment target {resource.Name}", 474var moduleDirectory = outputDirectory.CreateSubdirectory(resource.Name); 476var modulePath = Path.Combine(moduleDirectory.FullName, $"{resource.Name}.bicep"); 485$"Wrote bicep module for deployment target {resource.Name} to {modulePath}",
AzureResourceExtensions.cs (1)
41Infrastructure.NormalizeBicepIdentifier(resource.Name);
AzureResourcePreparer.cs (5)
101executeCommand: context => command.ExecuteCommand(context.Services.GetRequiredService<AzureProvisioningController>(), resource.Resource.Name, context), 113UpdateState = context => context.Services.GetRequiredService<AzureProvisioningController>().GetResourceCommandState(resource.Resource.Name, command.Command, context) 120=> resource.AzureResource is AzureBicepResource bicepResource ? bicepResource.Name : resource.Resource.Name; 452identityResource = new AzureUserAssignedIdentityResource($"{resource.Name}-identity") 471$"{resource.Name}-roles-{targetResource.Name}",
Aspire.Hosting.Azure.AppContainers (32)
AzureContainerAppEnvironmentResource.cs (3)
282$"'{endpointReference.EndpointName}' on resource '{endpointReference.Resource.Name}'. " + 400builder.AppendLiteral(resource.Name.ToLowerInvariant()); 450var normalizedResourceName = Infrastructure.NormalizeBicepIdentifier(resource.Name);
AzureContainerAppExtensions.cs (5)
85throw new InvalidOperationException($"Resource '{r.Name}' is configured to publish as an Azure Container App, but there are no '{nameof(AzureContainerAppEnvironmentResource)}' resources. Ensure you have added one by calling '{nameof(AddAzureContainerAppEnvironment)}'."); 523$"{BicepFunction.ToLower(output.resource.Name)}-{BicepFunction.ToLower(volumeName)}"), 528$"{BicepFunction.ToLower(output.resource.Name)}-{BicepFunction.ToLower(volumeName)}"), 547$"{BicepFunction.ToLower(output.resource.Name)}-{BicepFunction.ToLower(volumeName)}"), 552$"{BicepFunction.ToLower(output.resource.Name)}-{BicepFunction.ToLower(volumeName)}-{resourceToken}"),
AzureContainerAppResource.cs (10)
42Name = $"print-{targetResource.Name}-summary", 43Description = $"Prints the deployment summary and URL for {targetResource.Name}.", 49var portalLink = await ContainerAppUrls.GetPortalLinkAsync(containerAppEnv, targetResource.Name.ToLowerInvariant(), ctx.CancellationToken).ConfigureAwait(false); 53var endpoint = $"https://{targetResource.Name.ToLowerInvariant()}.{domainValue}"; 56ctx.ReportingStep.Log(LogLevel.Information, new MarkdownString($"Successfully deployed **{targetResource.Name}** to {summaryValue}")); 57ctx.Summary.Add(targetResource.Name, new MarkdownString(summaryValue)); 63ctx.ReportingStep.Log(LogLevel.Information, new MarkdownString($"Successfully deployed **{targetResource.Name}** to Azure Container Apps environment **{containerAppEnv.Name}**. {summaryValue}")); 64ctx.Summary.Add(targetResource.Name, new MarkdownString(summaryValue)); 73Name = $"deploy-{targetResource.Name}", 74Description = $"Aggregation step for deploying {targetResource.Name} to Azure Container Apps.",
BaseContainerAppContext.cs (1)
26public string NormalizedContainerAppName => resource.Name.ToLowerInvariant();
ContainerAppContext.cs (2)
107var containerApp = new ContainerApp(Infrastructure.NormalizeBicepIdentifier(Resource.Name)) 253_containerAppEnvironmentContext.RecordHttpsUpgrade(Resource.Name, upgradedEndpoints);
ContainerAppEnvironmentContext.cs (3)
76throw new InvalidOperationException($"Container app context not found for resource {resource.Name}."); 90var provisioningResource = new AzureContainerAppResource(resource.Name + "-containerapp", context.BuildContainerApp, resource) 114throw new InvalidOperationException($"Resource '{resource.Name}' cannot have both AzureContainerAppCustomizationAnnotation and AzureContainerAppJobCustomizationAnnotation.");
ContainerAppJobContext.cs (1)
88var containerApp = new ContainerAppJob(Infrastructure.NormalizeBicepIdentifier(Resource.Name))
src\Shared\CrossScopeAcrPullIdentityPreparer.cs (4)
54Name = $"prepare-cross-scope-acr-pull-identity-{builder.Resource.Name}", 55Description = $"Prepares the ACR pull identity for {builder.Resource.Name}.", 115var identityName = $"{builder.Resource.Name}-mi"; 119$"Cannot create the cross-scope ACR pull identity '{identityName}' for environment '{builder.Resource.Name}' because a resource with that name already exists. Call 'WithAcrPullIdentity' on the environment to select an existing identity, or use a different resource name.");
src\Shared\ResourceNameComparer.cs (3)
17return x.Name.Equals(y.Name, StringComparison.Ordinal); 21obj?.Name.GetHashCode(StringComparison.Ordinal) ?? 0;
Aspire.Hosting.Azure.AppService (26)
AzureAppServiceEnvironmentContext.cs (2)
66throw new InvalidOperationException($"App Service context not found for resource {resource.Name}."); 80var provisioningResource = new AzureAppServiceWebSiteResource(resource.Name + "-website", context.BuildWebSite, resource)
AzureAppServiceEnvironmentExtensions.cs (1)
58throw new InvalidOperationException($"Resource '{r.Name}' is configured to publish as an Azure AppService Website, but there are no '{nameof(AzureAppServiceEnvironmentResource)}' resources. Ensure you have added one by calling '{nameof(AddAzureAppServiceEnvironment)}'.");
AzureAppServiceEnvironmentResource.cs (2)
337sb.AppendLine("Resource '" + resource.Name + "' cannot be published to Azure App Service because it has environment variables with '-' in the name."); 511return ReferenceExpression.Create($"{resource.Name.ToLowerInvariant()}-{WebSiteSuffix}.azurewebsites.net");
AzureAppServiceWebsiteContext.cs (7)
42BicepFunction.Interpolate($"{BicepFunction.ToLower(resource.Name)}-{AzureAppServiceEnvironmentResource.GetWebSiteSuffixBicep()}"), 60); 52BicepFunction.Interpolate($"{BicepFunction.ToLower(resource.Name)}-{AzureAppServiceEnvironmentResource.GetWebSiteSuffixBicep()}"), AzureAppServiceWebSiteResource.MaxWebSiteNamePrefixLengthWithSlot); 141throw new NotSupportedException($"The endpoint(s) {string.Join(", ", unsupportedEndpoints.Select(r => $"'{r.Endpoint.Name}'"))} on resource '{resource.Name}' specifies an unsupported scheme. Only http and https are supported in App Service."); 164throw new NotSupportedException($"The endpoint '{endpoint.Name}' on resource '{resource.Name}' is not external. App Service only supports external endpoints."); 191environmentContext.RecordHttpsUpgrade(resource.Name, upgradedEndpoints); 935var otelServiceName = isSlot ? BicepFunction.Interpolate($"{resource.Name}-{deploymentSlot}") : resource.Name;
AzureAppServiceWebSiteResource.cs (7)
42Name = $"print-{targetResource.Name}-summary", 43Description = $"Prints the deployment summary and URL for {targetResource.Name}.", 62ctx.ReportingStep.Log(LogLevel.Information, new MarkdownString($"Successfully deployed **{targetResource.Name}** to {summaryValue}")); 63ctx.Summary.Add(targetResource.Name, new MarkdownString(summaryValue)); 71Name = $"deploy-{targetResource.Name}", 72Description = $"Aggregation step for deploying {targetResource.Name} to Azure App Service.", 113return TruncateToMaxLength($"{TargetResource.Name.ToLowerInvariant()}-{websiteSuffix}", 60);
src\Shared\CrossScopeAcrPullIdentityPreparer.cs (4)
54Name = $"prepare-cross-scope-acr-pull-identity-{builder.Resource.Name}", 55Description = $"Prepares the ACR pull identity for {builder.Resource.Name}.", 115var identityName = $"{builder.Resource.Name}-mi"; 119$"Cannot create the cross-scope ACR pull identity '{identityName}' for environment '{builder.Resource.Name}' because a resource with that name already exists. Call 'WithAcrPullIdentity' on the environment to select an existing identity, or use a different resource name.");
src\Shared\ResourceNameComparer.cs (3)
17return x.Name.Equals(y.Name, StringComparison.Ordinal); 21obj?.Name.GetHashCode(StringComparison.Ordinal) ?? 0;
Aspire.Hosting.Azure.ContainerRegistry (2)
AzureContainerRegistryExtensions.cs (2)
118var containerRegistry = builder.Resource.ContainerRegistry ?? throw new InvalidOperationException($"The resource '{builder.Resource.Name}' does not have an associated Azure Container Registry."); 119var registry = containerRegistry as AzureContainerRegistryResource ?? throw new InvalidOperationException($"The Container Registry associated with resource '{builder.Resource.Name}' is not an Azure Container Registry.");
Aspire.Hosting.Azure.EntraId (11)
EntraIdApiAccess.cs (1)
57? application.Consumers.Select(static c => c.Name).Distinct(StringComparer.OrdinalIgnoreCase)
EntraIdApplicationResource.cs (7)
303? $"'{consumer.Name}' references the Entra ID applications '{other.Source.Name}' and '{reference.Source.Name}', and both declare permissions to an API that is configured as " + 306: $"'{consumer.Name}' would receive the DownstreamApis entries '{other.Entry}' (of '{other.Source.Name}') and '{entry.Name}' (of '{reference.Source.Name}') as the same " + 320$"Resource '{target.Name}' is trusted by Entra ID application '{Name}' but does not reference it, so it would not receive the configuration. " + 321$"Call WithReference on '{target.Name}' with the Entra ID application."); 1060$"Resource '{consumer.Name}' references Entra ID application '{application.Name}', which uses a managed identity credential, " + 1066$"Resource '{consumer.Name}' references Entra ID application '{application.Name}', which trusts managed identity '{ManagedIdentity.Name}', " + 1067$"but the resource does not use that identity. Call WithAzureUserAssignedIdentity on '{consumer.Name}' with that identity.");
EntraIdEndpointRedirectUri.cs (3)
66$"Resource '{Endpoint.Resource.Name}' does not have a compute environment. " + 99&& string.Equals(e.Resource.Name, endpoint.Resource.Name, StringComparison.Ordinal)
Aspire.Hosting.Azure.EntraId.Tests (3)
EntraIdInitializationTests.cs (2)
503var update = await notifications.WaitForResourceAsync(resource.Name, 517Assert.True(notifications.TryGetCurrentState(resource.Name, out var resourceEvent));
EntraIdProvisioningTests.cs (1)
1074ReferenceExpression.Create($"{endpointReference.Resource.Name}.contoso.example");
Aspire.Hosting.Azure.EventHubs (2)
AzureEventHubsExtensions.cs (2)
307context.EnvironmentVariables["BLOB_SERVER"] = $"{blobEndpoint.Resource.Name}:{blobEndpoint.TargetPort}"; 308context.EnvironmentVariables["METADATA_SERVER"] = $"{tableEndpoint.Resource.Name}:{tableEndpoint.TargetPort}";
Aspire.Hosting.Azure.FrontDoor (13)
AzureFrontDoorExtensions.cs (12)
89var originBicepId = Infrastructure.NormalizeBicepIdentifier(originResource.Name); 142privateLink.ConfigureOrigin(computeEnv, originResource.Name, origin); 210.Any(a => a.Resource.Name == resource.Resource.Name)) 213$"Origin resource '{resource.Resource.Name}' has already been added to Azure Front Door resource '{builder.Resource.Name}'. " + 228$"Resource '{resource.Name}' does not have a compute environment. " + 244$"Resource '{resource.Name}' does not have an external HTTP or HTTPS endpoint. " + 298$"Origin '{originName}' of Azure Front Door '{frontDoor.Name}' runs in compute environment '{environment.Name}', " + 300$"Call {nameof(AzureFrontDoorPrivateLinkExtensions.WithAzureFrontDoorPrivateLink)} on '{environment.Name}' with '{frontDoor.Name}' to connect it."); 330$"Azure Front Door '{frontDoor.Name}' is connected to compute environment '{connection.Environment.Name}' through Private Link, " + 331$"but none of its origins run in that environment. Add apps in '{connection.Environment.Name}' with " + 346var environmentIdentifier = Infrastructure.NormalizeBicepIdentifier(environment.Name);
AzureFrontDoorPrivateLinkAnnotation.cs (1)
25var message = $"Azure Front Door {frontDoor.Name} requests access to {environment.Name}.";
Aspire.Hosting.Azure.Functions (3)
AzureFunctionsProjectResourceExtensions.cs (2)
643connectionName ??= source.Resource.Name; 659connectionName ??= source.Resource.Name;
src\Shared\LaunchProfiles\LaunchProfileExtensions.cs (1)
30return projectMetadata.GetLaunchSettings(projectResource.Name);
Aspire.Hosting.Azure.Kubernetes (7)
AzureKubernetesEnvironmentExtensions.cs (2)
126if (context.Model.Resources.Any(existing => StringComparer.OrdinalIgnoreCase.Equals(existing.Name, identity.Name))) 194var resourceName = pushStep.Resource?.Name;
AzureKubernetesEnvironmentResource.AksPipeline.cs (5)
84var saName = $"{r.Name}-sa"; 95$"{{{{ .Values.parameters.{r.Name}.identityClientId }}}}"; 103$"{{{{ .Values.parameters.{r.Name}.identityClientId }}}}", 128r.Name, 134WorkloadIdentities[r.Name] = appIdentity.IdentityResource;
Aspire.Hosting.Azure.Network (3)
AzureNetworkSecurityPerimeterExtensions.cs (1)
144associationName ??= $"{target.Resource.Name}-assoc";
AzurePrivateEndpointExtensions.cs (1)
58var name = $"{subnet.Resource.Name}-{target.Resource.Name}-pe";
AzureVirtualNetworkExtensions.cs (1)
323$"The resource '{target.Name}' is already associated with a different delegated subnet. A resource can use only one delegated subnet.");
Aspire.Hosting.Azure.Sandboxes (39)
AzureSandboxContainerDeployment.cs (22)
67Description = $"Deploys compute resource '{resource.TargetResource.Name}' to ACA sandbox '{resource.Name}'.", 168$"Azure sandbox resource '{resource.TargetResource.Name}' in sandbox group '{resource.Parent.Name}' references resource '{dependency.Name}' in sandbox group '{producer.Parent.Name}', but cross-group sandbox references are not supported. Deploy both resources to the same sandbox group."); 179$"Azure sandbox resources '{resource.TargetResource.Name}' and '{producer.TargetResource.Name}' have a circular deployment dependency."); 297var diskImageName = CreateSandboxResourceName(targetResource.Name, deployId); 299var diskTask = await context.ReportingStep.CreateTaskAsync($"Creating sandbox disk image for {targetResource.Name}", context.CancellationToken).ConfigureAwait(false); 326var createTask = await context.ReportingStep.CreateTaskAsync($"Creating sandbox for {targetResource.Name}", context.CancellationToken).ConfigureAwait(false); 404stateSection.Data["SourceResourceName"] = targetResource.Name; 499context.Summary.Add(resource.TargetResource.Name, new MarkdownString(CreateSandboxUrlSummary(publicUrl, retainedUrl))); 503context.Summary.Add(resource.TargetResource.Name, new MarkdownString($"Sandbox `{sandboxId}`")); 571["aspire-source"] = resource.TargetResource.Name, 925throw new NotSupportedException($"Resource '{resource.Name}' configures container mounts, but Azure sandbox volume provisioning is not supported by this preview integration."); 978?? throw new InvalidOperationException($"Could not resolve the pushed container image for resource '{resource.TargetResource.Name}'."); 986throw new NotSupportedException($"Resource '{resource.TargetResource.Name}' cannot be deployed to Azure sandbox group '{resource.Parent.Name}' because it does not produce or reference a container image."); 1496$"Endpoint '{resolvedEndpoint.Endpoint.Name}' on project resource '{resource.TargetResource.Name}' is exposed through Azure sandbox ingress, which terminates TLS and forwards plaintext HTTP. " + 1504throw new InvalidOperationException($"Endpoint '{resolvedEndpoint.Endpoint.Name}' on resource '{resource.TargetResource.Name}' does not have a target port. Configure a target port before deploying it to an Azure sandbox."); 1523throw new NotSupportedException($"Endpoint '{resolvedEndpoint.Endpoint.Name}' on resource '{resource.TargetResource.Name}' shares target port {resolvedTargetPort} with endpoint '{existingEndpoint.Name}' but uses a different transport. Azure sandbox ports support a single HTTP protocol per target port."); 1530throw new NotSupportedException($"Endpoint '{resolvedEndpoint.Endpoint.Name}' on resource '{resource.TargetResource.Name}' shares target port {resolvedTargetPort} with endpoint '{existingEndpoint.Name}' but configures a different anonymous-access policy. Azure sandbox ports support a single access policy per target port."); 1548throw new InvalidOperationException($"Resource '{resource.TargetResource.Name}' has Azure sandbox endpoint options for endpoint(s) that are not exposed by EndpointAnnotation: {string.Join(", ", unmatchedEndpointOptions)}."); 1580_ => throw new NotSupportedException($"Endpoint '{endpoint.Name}' on resource '{resource.Name}' uses transport '{endpoint.Transport}'. Azure sandbox ports currently support only HTTP and HTTP/2 endpoints.") 2101stateSection.Data["SourceResourceName"] ??= resource.TargetResource.Name;
AzureSandboxEndpointPropertyValueProvider.cs (5)
32throw new InvalidOperationException($"Endpoint '{endpointReferenceExpression.Endpoint.EndpointName}' on resource '{resource.TargetResource.Name}' does not have a target port."); 98throw new InvalidOperationException($"Azure sandbox deployment state for resource '{_resource.TargetResource.Name}' endpoint '{_endpointReferenceExpression.Endpoint.EndpointName}' contains invalid URL '{url}'."); 115new($"Azure sandbox endpoint '{_endpointReferenceExpression.Endpoint.EndpointName}' on resource '{_resource.TargetResource.Name}' does not have a deployed URL yet. Runtime sandbox URLs cannot be used as first-pass Azure provisioning values; deploy the producing sandbox before resolving this reference."); 121throw new InvalidOperationException($"Endpoint '{_endpointReferenceExpression.Endpoint.EndpointName}' on resource '{_resource.TargetResource.Name}' is not exposed by the Azure sandbox deployment target."); 181throw new InvalidOperationException($"Endpoint '{endpointName}' on resource '{resource.TargetResource.Name}' is not exposed by the Azure sandbox deployment target. Configure it as an external HTTP endpoint before referencing its sandbox URL.");
AzureSandboxesExtensions.cs (3)
471$"Resource '{resource.Name}' is configured to publish as an Azure sandbox, but there are no '{nameof(AzureSandboxGroupResource)}' resources. " + 481$"Resource '{resource.Name}' is configured to publish as an Azure sandbox, but it is assigned to compute environment '{computeEnvironment.Name}', which is not an active Azure sandbox group. " +
AzureSandboxGroupResource.cs (5)
234$"Compute resource '{resource.Name}' uses an application identity type that Azure sandboxes do not support."); 240$"Compute resource '{resource.Name}' uses managed identity '{userAssignedIdentity.Name}', but workload identities are not supported when publishing to existing Azure sandbox group '{Name}'."); 246$"Azure sandbox group '{Name}' uses identity '{userAssignedIdentity.Name}' for both image pulls and workload '{resource.Name}'. " + 266$"{resource.Name}-sandbox-container", 308throw new InvalidOperationException($"Resource '{resource.Name}' is not deployed to Azure sandbox group '{Name}'.");
src\Shared\CrossScopeAcrPullIdentityPreparer.cs (4)
54Name = $"prepare-cross-scope-acr-pull-identity-{builder.Resource.Name}", 55Description = $"Prepares the ACR pull identity for {builder.Resource.Name}.", 115var identityName = $"{builder.Resource.Name}-mi"; 119$"Cannot create the cross-scope ACR pull identity '{identityName}' for environment '{builder.Resource.Name}' because a resource with that name already exists. Call 'WithAcrPullIdentity' on the environment to select an existing identity, or use a different resource name.");
Aspire.Hosting.Azure.Tests (73)
AzureContainerAppEnvironmentExtensionsTests.cs (1)
597var api = model.Resources.First(r => r.Name == "api");
AzureContainerAppsTests.cs (11)
820.Where(resource => resource.Name is "project" or "executable") 821.OrderBy(resource => resource.Name)) 2511var funcjob = model.Resources.Single(r => r.Name == "funcjob"); 2555var batch = containers.First(c => c.Name == "batch"); 2556var web = containers.First(c => c.Name == "web"); 2780var container = model.Resources.Single(r => r.Name == "api"); 2784var buildOnly = model.Resources.Single(r => r.Name == "build-only"); 3028var webappAcaResource = model.Resources.First(r => r.Name == "webappaca"); 3034var webappServiceResource = model.Resources.First(r => r.Name == "webappservice"); 3040var containerAcaResource = model.Resources.First(r => r.Name == "containeraca"); 3048var containerAppServiceResource = model.Resources.First(r => r.Name == "containerappservice");
AzureDeployerTests.cs (7)
375Assert.Equal("exe", builtImage.Name); 561resource.Name == "api"); 627resource.Name == "api"); 922resource.Name == "api-service"); 924resource.Name == "python-app"); 927Assert.DoesNotContain(mockImageBuilder.PushImageCalls, resource => resource.Name == "cache"); 1443resource.Name == "funcapp");
AzureEventHubsExtensionsTests.cs (2)
512var azurite = builder.Resources.FirstOrDefault(x => x.Name == "eh-storage"); 530var azurite = builder.Resources.FirstOrDefault(x => x.Name == "eh-storage");
AzureFrontDoorPrivateLinkTests.cs (1)
536=> ReferenceExpression.Create($"{endpointReference.Resource.Name}.{new BicepOutputReference("domain", this)}");
AzureFunctionsTests.cs (6)
40resource is AzureStorageResource && resource.Name.StartsWith(AzureFunctionsProjectResourceExtensions.DefaultAzureFunctionsHostStorageName)); 43resource is AzureFunctionsProjectResource && resource.Name == "funcapp"); 345resource is AzureStorageResource && resource.Name.StartsWith(AzureFunctionsProjectResourceExtensions.DefaultAzureFunctionsHostStorageName)); 347resource is AzureFunctionsAppResource && resource.Name == "funcapp"); 980resource is AzureStorageResource && resource.Name.StartsWith(AzureFunctionsProjectResourceExtensions.DefaultAzureFunctionsHostStorageName)); 983resource is AzureFunctionsProjectResource && resource.Name == "funcapp");
AzureManagedRedisExtensionsTests.cs (1)
133var cacheInModel = builder.Resources.Single(r => r.Name == "cache");
AzureManifestUtils.cs (1)
31string manifestDir = Directory.CreateTempSubdirectory(resource.Name).FullName;
AzurePostgresExtensionsTests.cs (2)
297var postgresResourceInModel = builder.Resources.Single(r => r.Name == "postgres-data"); 298var dbResourceInModel = builder.Resources.Single(r => r.Name == "db1");
AzureRedisExtensionsTests.cs (1)
177var cacheInModel = builder.Resources.Single(r => r.Name == "cache");
AzureResourcePreparerTests.cs (4)
121Assert.Equal(["first", "second"], role.GetAzureReferences().Select(resource => resource.Name).Order()); 596Assert.Collection(model.Resources.Select(r => r.Name), 631Assert.Collection(model.Resources.Select(r => r.Name), 644Assert.DoesNotContain(model.Resources, r => r.Name == "frontend-identity");
AzureSandboxesTests.cs (14)
477var computeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "frontend"); 480Assert.DoesNotContain(model.Resources, resource => resource.Name == "sandboxes-acr"); 2018var computeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "frontend"); 2184var computeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "frontend"); 2246var computeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "frontend"); 2285var computeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "frontend"); 2309var computeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "cache"); 2352var computeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "frontend"); 2353var explicitComputeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "backend"); 2456var cleanupResource = Assert.Single(model.Resources, resource => resource.Name == "azure-sandbox-cleanup"); 2509Assert.Single(model.Resources, resource => resource.Name == "azure-sandbox-cleanup"); 2534var computeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "frontend"); 2597var computeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "frontend"); 2865var computeResource = Assert.Single(model.GetComputeResources(), resource => resource.Name == "frontend");
AzureServiceBusExtensionsTests.cs (9)
607var sql = builder.Resources.FirstOrDefault(x => x.Name == "sb-mssql"); 625var sql = builder.Resources.FirstOrDefault(x => x.Name == "sb-mssql"); 647var sql = Assert.Single(builder.Resources, x => x.Name == "sb-mssql"); 669var sql = Assert.Single(builder.Resources, x => x.Name == "sb-mssql"); 681var sql = Assert.Single(builder.Resources, x => x.Name == "sb-mssql"); 695var sql = Assert.Single(builder.Resources, x => x.Name == "sb-mssql"); 712var sql = Assert.Single(builder.Resources, x => x.Name == "sb-mssql"); 727var sql = Assert.Single(builder.Resources, x => x.Name == "sb-mssql"); 826var sql = Assert.Single(builder.Resources, x => x.Name == "sb-mssql");
AzureSqlExtensionsTests.cs (2)
217var sqlResourceInModel = builder.Resources.Single(r => r.Name == "sql"); 218var dbResourceInModel = builder.Resources.Single(r => r.Name == "db1");
AzureUserAssignedIdentityTests.cs (6)
81Assert.Equal("myidentity-roles-myregistry", r.Name); 173var computeResource = Assert.Single(model.Resources.OfType<IComputeResource>(), r => r.Name == "myapp"); 220var computeResource = Assert.Single(model.Resources.OfType<IComputeResource>(), r => r.Name == "myapp"); 278var computeResource = Assert.Single(model.Resources.OfType<IComputeResource>(), r => r.Name == "myapp"); 359var computeResource = Assert.Single(model.Resources.OfType<IComputeResource>(), r => r.Name == "myapp"); 361var computeResource2 = Assert.Single(model.Resources.OfType<IComputeResource>(), r => r.Name == "myapp2");
FoundryExtensionsTests.cs (1)
699Assert.DoesNotContain(builder.Resources, r => r.Name == "my-project-acr");
RoleAssignmentTests.cs (4)
245Assert.DoesNotContain(model.Resources, r => r.Name == "api-roles-keyvault"); 277Assert.DoesNotContain(model.Resources, r => r.Name == "api-roles-keyvault"); 278Assert.DoesNotContain(model.Resources, r => r.Name == "api-roles-sb"); 331Assert.DoesNotContain(model.Resources, r => r.Name == "webfrontend-roles-cache");
Aspire.Hosting.Blazor (18)
BlazorGatewayExtensions.cs (5)
310if (!existingGatewayRefs.Contains(endpointRef.Resource.Name)) 382GetBlazorStorePath(gateway.ApplicationBuilder), "gateways", gateway.Resource.Name); 395?? throw new InvalidOperationException($"The gateway '{gateway.Resource.Name}' must define an HTTP or HTTPS endpoint."); 779var service = new GatewayAppService(annotation.Resource.Name); 799.Select(a => a.Resource.Name)
BlazorHostedExtensions.cs (7)
63annotation.Services.Add(new HostedClientService(service.Resource.Name, apiPrefix)); 67if (!existingRefs.Contains(service.Resource.Name)) 172var debuggerName = $"{host.Resource.Name}-wasm-debugger"; 173if (!host.ApplicationBuilder.Resources.Any(r => r.Name == debuggerName)) 229?? throw new InvalidOperationException($"The host '{host.Resource.Name}' must define an HTTP or HTTPS endpoint."); 246$"{host.Resource.Name} (client)", 270.Select(a => a.Resource.Name)
BrowserDebuggerHelper.cs (5)
70? $"{parentResource.Name}-{commandTarget.Resource.Name}-debugger" 71: $"{parentResource.Name}-wasm-debugger"; 111$"Resource '{parentResource.Name}' does not have an HTTP or HTTPS endpoint. " + 348return resource.Name;
GatewayOriginReference.cs (1)
14public string ValueExpression => $"{{{endpoint.Resource.Name}.bindings.{endpoint.EndpointName}.url}}";
Aspire.Hosting.Blazor.Tests (23)
AddBlazorGatewayTests.cs (1)
498annotation => annotation.Resource.Name == "weatherapi");
AddDotnetProjectBlazorGatewayTests.cs (1)
56.Select(r => r.Resource.Name)
BlazorHostedExtensionsTests.cs (14)
37var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 77var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 98var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 116var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 139var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 168var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 368var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 388var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 415.SingleOrDefault(a => a.Resource.Name == "weatherapi"); 433var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 466.Count(a => a.Resource.Name == "weatherapi"); 488.Select(a => a.Resource.Name) 505var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp"); 524var blazorApp = builder.Resources.Single(r => r.Name == "blazorapp");
BrowserDebuggerHelperTests.cs (1)
146Assert.True(notificationService.TryGetCurrentState(resource.Name, out var currentState));
WithBlazorAppTests.cs (6)
99.Select(r => r.Resource.Name) 126.Count(r => r.Resource.Name == "weatherapi"); 154.Where(r => r.Resource.Name == "weatherapi" && r.Type == "Reference") 399.SingleOrDefault(a => a.Resource.Name == "weatherapi"); 428.SingleOrDefault(a => a.Resource.Name == "weatherapi"); 469.SingleOrDefault(a => a.Resource.Name == "weatherapi");
Aspire.Hosting.Browsers (14)
BrowserLogsBuilderExtensions.cs (6)
132var initialConfiguration = BrowserConfiguration.Resolve(builder.ApplicationBuilder.Configuration, parentResource.Name, explicitConfigurationValues); 134$"{parentResource.Name}-browser-logs", 149Properties = CreateInitialProperties(parentResource.Name, initialConfiguration) 186if (resourceNotifications.TryGetCurrentState(parentResource.Name, out var resourceEvent)) 330throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsResourceMissingHttpEndpoint, resource.Name)); 336throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsEndpointNotAllocated, endpointAnnotation.Name, resource.Name));
BrowserLogsConfigurationManager.cs (6)
38var parentResourceName = resource.ParentResource.Name; 161? resource.ParentResource.Name 340var (resourceConfiguration, globalConfiguration) = configurationStore.GetConfigurations(resource.ParentResource.Name); 352resource.ParentResource.Name, 370? $"{BrowserLogsBuilderExtensions.BrowserLogsConfigurationSectionName}:{resource.ParentResource.Name}" 392configurationStore.Set(selected.Scope, resource.ParentResource.Name, ToBrowserConfiguration(selected));
BrowserLogsResource.cs (2)
24var (resourceConfiguration, globalConfiguration) = configurationStore?.GetConfigurations(ParentResource.Name) ?? default; 27ParentResource.Name,
Aspire.Hosting.Browsers.Tests (18)
BrowserLogsBuilderExtensionsTests.cs (4)
48Assert.Equal(web.Resource.Name, browserLogsResource.ParentResource.Name); 55Assert.Equal(web.Resource.Name, parentRelationship.Resource.Name); 700var webBrowserLogsResource = browserLogsResources.Single(resource => resource.ParentResource.Name == "web"); 701var adminBrowserLogsResource = browserLogsResources.Single(resource => resource.ParentResource.Name == "admin");
src\Aspire.Hosting.Browsers\BrowserLogsBuilderExtensions.cs (6)
132var initialConfiguration = BrowserConfiguration.Resolve(builder.ApplicationBuilder.Configuration, parentResource.Name, explicitConfigurationValues); 134$"{parentResource.Name}-browser-logs", 149Properties = CreateInitialProperties(parentResource.Name, initialConfiguration) 186if (resourceNotifications.TryGetCurrentState(parentResource.Name, out var resourceEvent)) 330throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsResourceMissingHttpEndpoint, resource.Name)); 336throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsEndpointNotAllocated, endpointAnnotation.Name, resource.Name));
src\Aspire.Hosting.Browsers\BrowserLogsConfigurationManager.cs (6)
38var parentResourceName = resource.ParentResource.Name; 161? resource.ParentResource.Name 340var (resourceConfiguration, globalConfiguration) = configurationStore.GetConfigurations(resource.ParentResource.Name); 352resource.ParentResource.Name, 370? $"{BrowserLogsBuilderExtensions.BrowserLogsConfigurationSectionName}:{resource.ParentResource.Name}" 392configurationStore.Set(selected.Scope, resource.ParentResource.Name, ToBrowserConfiguration(selected));
src\Aspire.Hosting.Browsers\BrowserLogsResource.cs (2)
24var (resourceConfiguration, globalConfiguration) = configurationStore?.GetConfigurations(ParentResource.Name) ?? default; 27ParentResource.Name,
Aspire.Hosting.Containers.Tests (6)
ContainerResourceTests.cs (5)
25Assert.Equal("container", containerResource.Name); 44Assert.Equal("container", containerResource.Name); 63Assert.Equal("container", containerResource.Name); 83Assert.Equal("container", containerResource.Name); 337Assert.Equal("containerwithbindmounts", containerResource.Name);
ResourceFailureLoggingTests.cs (1)
118var category = $"{builder.ApplicationBuilder.Environment.ApplicationName}.Resources.{builder.Resource.Name}";
Aspire.Hosting.DevTunnels (16)
DevTunnelResourceBuilderExtensions.cs (13)
215portLogger.LogInformation("Configured dev tunnel port '{Port}' on tunnel '{Tunnel}' targeting endpoint '{Endpoint}' on resource '{TargetResource}'", tunnelPort, portResource.DevTunnel.TunnelId, portResource.TargetEndpoint.EndpointName, portResource.TargetEndpoint.Resource.Name); 479ErrorMessage = $"The dev tunnel '{tunnelResource.Name}' has not been associated with '{endpointName}' on resource '{targetResource.Name}'. Use 'WithReference({targetResource.Name})' on the dev tunnel to expose this endpoint." 524var serviceName = targetResource.Resource.Name; 574throw new ArgumentException($"Target endpoint '{targetEndpoint.EndpointName}' on resource '{targetEndpoint.Resource.Name}' has already been added to dev tunnel '{tunnel.Name}'.", nameof(targetEndpoint)); 584throw new ArgumentException($"Cannot tunnel endpoint '{targetEndpointAnnotation.Name}' with host '{targetEndpointAnnotation.TargetHost}' on resource '{targetResource.Name}' because it is not a localhost endpoint.", nameof(targetEndpoint)); 596_ => throw new ArgumentException($"Cannot tunnel endpoint '{targetEndpoint.EndpointName}' on resource '{targetResource.Name}' because it uses the unsupported scheme '{targetEndpoint.Scheme}'. Only 'http' and 'https' endpoints can be tunneled."), 598portOptions.Description ??= $"{targetResource.Name}/{targetEndpoint.EndpointName}"; 600var portName = $"{tunnel.Name}-{targetResource.Name}-{targetEndpoint.EndpointName}"; 602portOptions.Labels.Add(targetResource.Name); 707new(CustomResourceKnownProperties.Source, $"{targetResource.Name}/{targetEndpoint.EndpointName}"), 708new("TargetResource", targetResource.Name), 760NormalizeUrl(portUri), portResource.TargetEndpoint.Url, portResource.TargetEndpoint.Resource.Name, portResource.TargetEndpoint.EndpointName);
src\Shared\ResourceNameComparer.cs (3)
17return x.Name.Equals(y.Name, StringComparison.Ordinal); 21obj?.Name.GetHashCode(StringComparison.Ordinal) ?? 0;
Aspire.Hosting.DevTunnels.Tests (1)
TestDevTunnelMonitor.cs (1)
93Assert.True(App.ResourceNotifications.TryGetCurrentState(resource.Name, out var current));
Aspire.Hosting.Docker (25)
DockerComposeEnvironmentContext.cs (3)
19logger.LogInformation("Creating Docker Compose resource for {ResourceName}", resource.Name); 21var serviceResource = new DockerComposeServiceResource(resource.Name, resource, environment); 60serviceResource.TargetResource.Name,
DockerComposeEnvironmentExtensions.cs (1)
46throw new InvalidOperationException($"Resource '{r.Name}' is configured to publish as a Docker Compose service, but there are no '{nameof(DockerComposeEnvironmentResource)}' resources. Ensure you have added one by calling '{nameof(AddDockerComposeEnvironment)}'.");
DockerComposeEnvironmentResource.cs (2)
267return ReferenceExpression.Create($"{resource.Name.ToLowerInvariant()}"); 402context.EnvironmentVariables[KnownOtelConfigNames.ServiceName] = resource.Name;
DockerComposePublishingContext.cs (1)
96var resourceDockerfilePath = Path.Combine(OutputPath, $"{serviceResource.TargetResource.Name}.Dockerfile");
DockerComposeServiceExtensions.cs (5)
119var imageEnvName = $"{resourceInstance.Name.ToUpperInvariant().Replace("-", "_")}_IMAGE"; 123description: $"Container image name for {resourceInstance.Name}", 124defaultValue: $"{resourceInstance.Name}:latest", 133var containerPortEnv = $"{resourceInstance.Name.ToUpperInvariant().Replace("-", "_")}_PORT"; 137description: $"Default container port for {resourceInstance.Name}",
DockerComposeServiceResource.cs (10)
46Name = $"print-{_targetResource.Name}-summary", 116Name = TargetResource.Name.ToLowerInvariant(), 193composeService.DependsOn[waitAnnotation.Resource.Name.ToLowerInvariant()] = new() 332new MarkdownString($"Successfully deployed **{TargetResource.Name}** to Docker Compose environment **{environment.Name}**. No public endpoints were configured.")); 333context.Summary.Add(TargetResource.Name, "No public endpoints"); 349context.ReportingStep.Log(LogLevel.Information, new MarkdownString($"Successfully deployed **{TargetResource.Name}** to {endpointList}.")); 350context.Summary.Add(TargetResource.Name, string.Join(", ", endpoints)); 356new MarkdownString($"Successfully deployed **{TargetResource.Name}** to Docker Compose environment **{environment.Name}**.")); 357context.Summary.Add(TargetResource.Name, "No public endpoints"); 370var serviceName = TargetResource.Name.ToLowerInvariant();
src\Shared\ResourceNameComparer.cs (3)
17return x.Name.Equals(y.Name, StringComparison.Ordinal); 21obj?.Name.GetHashCode(StringComparison.Ordinal) ?? 0;
Aspire.Hosting.Docker.Tests (6)
DockerComposePublisherTests.cs (1)
1161kv.Value.Resource?.Name == "yarp" &&
DockerComposeTests.cs (5)
886var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker"); 892var containerK8sResource = model.Resources.First(r => r.Name == "containerk8s"); 898var projectDockerResource = model.Resources.First(r => r.Name == "projectdocker"); 904var projectK8sResource = model.Resources.First(r => r.Name == "projectk8s"); 937var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker");
Aspire.Hosting.Dotnet (12)
DotnetProjectBuildCoordinator.cs (10)
188buildResource.Name, 197$"The coordinated .NET build failed with exit code {exitCode}. See resource '{buildResource.Name}' for build output."); 304notifications.TryGetCurrentState(rebuilder.Name, out var rebuildEvent) && 833candidate.Name == $"{resource.Name}-rebuilder" && 925resource.Name, 1005context.Resource.Name, 1227resource.Name, 1242resource.Name); 1259resource.Name, 1276resource.Name);
DotnetProjectHostingExtensions.cs (1)
173$"The .NET resource '{resource.Name}' uses WithBuildEnvironment, which is supported only for project files.");
src\Shared\LaunchProfiles\LaunchProfileExtensions.cs (1)
30return projectMetadata.GetLaunchSettings(projectResource.Name);
Aspire.Hosting.EntityFrameworkCore (10)
EFCoreOperationExecutor.cs (1)
437.Select(project => $"'{project.Name}'")
EFMigrationResourceBuilderExtensions.cs (4)
299$"EF Core migrations require a project file. Resource '{projectResource.Name}' is a file-based app."); 355.Create(connectionStringResource, connectionStringResource.Name) 416var unrelated = string.Join(", ", leaves.Select(l => $"'{l.Name}'")); 542.Create(primary, primary.Name)
EFResourceBuilderExtensions.cs (5)
241$"The DbContext type '{GetShortTypeName(dbContextTypeName)}' has already been registered for EF migrations on resource '{builder.Resource.Name}'."); 247$"Cannot register a specific DbContext type for migrations when they have already been registered without a context type on resource '{builder.Resource.Name}'."); 255$"Cannot register migrations without a context type when they have already been registered without a context type on resource '{builder.Resource.Name}'."); 259$"Cannot register migrations without a context type when they have already been registered for specific DbContext types on resource '{builder.Resource.Name}'."); 266$"EF Core migrations require a project file. Resource '{builder.Resource.Name}' is a file-based app.");
Aspire.Hosting.EntityFrameworkCore.Tests (1)
EFMigrationPipelineTests.cs (1)
307Assert.Equal("mydb", waitedResource.Name);
Aspire.Hosting.Foundry (26)
HostedAgent\AzureHostedAgentResource.cs (11)
45var deploymentAnnotation = Target.GetDeploymentTargetAnnotation() ?? throw new InvalidOperationException($"Deployment target annotation is required on resource '{Target.Name}' to deploy as hosted agent."); 47?? throw new InvalidOperationException($"Compute environment for resource '{Target.Name}' must be an AzureCognitiveServicesProjectResource to deploy as hosted agent."); 144ctx.Writer.WriteString("target", Target.Name); 179var options = configuration.ToProjectsAgentVersionCreationOptions(Target.Name); 335logger.LogDebug("Environment variable '{Key}' for resource '{Name}' is reserved by Foundry Hosted Agents and will be skipped.", key, target.Name); 344logger.LogDebug("Environment variable '{Key}' for resource '{Name}' references the hosted agent target port and will be skipped.", key, target.Name); 363logger.LogWarning("Environment variable '{Key}' for resource '{Name}' has unknown value of type '{type}' and will be skipped.", key, target.Name, value.GetType().FullName); 433throw new DistributedApplicationException($"The connection string for the resource '{connectionStringReference.Resource.Name}' is not available."); 504var reason = $"Resource '{endpointReference.Resource.Name}' does not have a compute environment deployment target."; 529$"Unable to resolve environment variable '{environmentVariableName}' for Foundry hosted agent '{hostedAgent.Name}' from target resource '{resource.Name}'. " + 530$"Endpoint '{endpointReference.EndpointName}' on resource '{endpointReference.Resource.Name}' cannot be used. {reason}");
HostedAgent\HostedAgentBuilderExtension.cs (9)
284.AddFoundry($"{builder.Resource.Name}-proj-foundry") 285.AddProject($"{builder.Resource.Name}-proj"); 409ctx.EnvironmentVariables.Add("OTEL_GENAI_AGENT_NAME", ctx.Resource.Name); 410ctx.EnvironmentVariables.Add("OTEL_GENAI_AGENT_ID", ctx.Resource.Name); 459var agentName = $"{resource.Name}-ha"; 474else if (builder.ApplicationBuilder.TryCreateResourceBuilder<ContainerResource>(resource.Name, out var containerResourceBuilder)) 491if (builder.ApplicationBuilder.TryCreateResourceBuilder(resource.Name, out containerResourceBuilder)) 497throw new InvalidOperationException($"Unable to create hosted agent for resource '{resource.Name}' because it could not be converted to a container resource."); 502throw new InvalidOperationException($"Unable to create hosted agent for resource '{resource.Name}' because it is not a container, executable, or project resource.");
Project\ProjectResource.cs (1)
254: resource.Name;
Toolbox\FoundryToolboxResource.cs (5)
494resource.Name, 500$"MCP dependency '{resource.Name}' entered terminal state '{state}' before it became ready."); 510model.Resources.Select(resource => resource.Name), 519modelResourceNames.Contains(referencedResource.Name) && 520seenResourceNames.Add(referencedResource.Name))
Aspire.Hosting.Foundry.Tests (7)
HostedAgentExtensionTests.cs (5)
83var resource = builder.Resources.Single(r => r.Name == "agent"); 108var resource = builder.Resources.Single(r => r.Name == "agent"); 138var resource = builder.Resources.Single(r => r.Name == "agent"); 614context.EnvironmentVariables["RESOURCE_NAME"] = context.Resource.Name; 897Assert.DoesNotContain(builder.Resources, r => r.Name == "my-project-acr");
ProjectResourceTests.cs (1)
47Assert.DoesNotContain(builder.Resources, r => r.Name == "my-project-acr");
PromptAgentTests.cs (1)
117var resource = builder.Resources.Single(r => r.Name == "my-agent");
Aspire.Hosting.Go (4)
GoHostingExtensions.cs (4)
203var binaryName = ctx.Resource.Name; 301.CopyFrom("build", $"/app/{ctx.Resource.Name}", $"/app/{ctx.Resource.Name}") 303.Entrypoint([$"/app/{ctx.Resource.Name}"]);
Aspire.Hosting.Go.Tests (14)
AddGoAppTests.cs (6)
1102var tidyResource = builder.Resources.First(r => r.Name == "api-mod-tidy"); 1103var vendorResource = builder.Resources.First(r => r.Name == "api-mod-vendor"); 1120var tidyResource = builder.Resources.First(r => r.Name == "api-mod-tidy"); 1121var downloadResource = builder.Resources.First(r => r.Name == "api-mod-download"); 1137var vendorResource = builder.Resources.First(r => r.Name == "api-mod-vendor"); 1138var downloadResource = builder.Resources.First(r => r.Name == "api-mod-download");
GoPublicApiTests.cs (8)
300var tidyResources = builder.Resources.Where(r => r.Name == "api-mod-tidy").ToList(); 310Assert.Contains(builder.Resources, r => r.Name == "api-mod-tidy"); 334var vendorResources = builder.Resources.Where(r => r.Name == "api-mod-vendor").ToList(); 344Assert.Contains(builder.Resources, r => r.Name == "api-mod-vendor"); 368var downloadResources = builder.Resources.Where(r => r.Name == "api-mod-download").ToList(); 378Assert.Contains(builder.Resources, r => r.Name == "api-mod-download"); 402var vetResources = builder.Resources.Where(r => r.Name == "api-vet-tool").ToList(); 412Assert.Contains(builder.Resources, r => r.Name == "api-vet-tool");
Aspire.Hosting.Java (1)
JavaHostingExtensions.cs (1)
1155$"Resource '{resource.Name}' has no Maven or Gradle build configured, so the OpenTelemetry agent location cannot be inferred. " +
Aspire.Hosting.Java.Tests (14)
AddJavaAppPublishTests.cs (1)
2386Resource = model.Resources.Single(resource => resource.Name == "api"),
AddJavaAppTests.cs (11)
1034Assert.Contains(builder.Resources, r => r.Name == "api-maven-build"); 1035Assert.Equal(JavaBuildTool.Maven, Assert.IsType<JavaBuildResource>(builder.Resources.First(r => r.Name == "api-maven-build")).Tool); 1047var buildResource = builder.Resources.First(r => r.Name == "api-maven-build"); 1060Assert.Contains(builder.Resources, r => r.Name == "api-gradle-build"); 1061Assert.Equal(JavaBuildTool.Gradle, Assert.IsType<JavaBuildResource>(builder.Resources.First(r => r.Name == "api-gradle-build")).Tool); 1073var buildResource = builder.Resources.First(r => r.Name == "api-gradle-build"); 1086Assert.DoesNotContain(builder.Resources, r => r.Name == "api-maven-build"); 1098Assert.DoesNotContain(builder.Resources, r => r.Name == "api-gradle-build"); 1152var buildResource = builder.Resources.First(r => r.Name == "api-maven-build"); 1166var buildResource = builder.Resources.First(r => r.Name == "api-gradle-build"); 1260Assert.Equal(["api"], builder.Resources.Select(resource => resource.Name).Order());
AddSpringBootAppTests.cs (2)
384Assert.DoesNotContain(builder.Resources, r => r.Name == "catalog-maven-build"); 388var buildResource = Assert.Single(builder.Resources, r => r.Name == "catalog-maven-build");
Aspire.Hosting.JavaScript (2)
DenoHostingExtensions.cs (1)
1065throw new InvalidOperationException($"Deno command-line options configured with the WithDeno* methods cannot be combined with package manager '{packageManager.ExecutableName}' on resource '{resource.Name}'. Remove the WithDeno* options or use WithDeno().");
JavaScriptHostingExtensions.cs (1)
3149return $"{scheme}://{resource.Name}";
Aspire.Hosting.JavaScript.Tests (1)
PackageInstallationTests.cs (1)
67var nodeResource = Assert.Single(appModel.Resources, r => r.Name == "test-app");
Aspire.Hosting.Kafka (2)
KafkaBuilderExtensions.cs (2)
164? ReferenceExpression.Create($"{endpoint.Resource.Name}:{endpoint.Property(EndpointProperty.TargetPort)}") 167context.EnvironmentVariables[$"KAFKA_CLUSTERS_{index}_NAME"] = endpoint.Resource.Name;
Aspire.Hosting.Kafka.Tests (1)
AddKafkaTests.cs (1)
236var kafkaUiResource = Assert.Single(builder.Resources, r => r.Name == expectedContainerName);
Aspire.Hosting.Keycloak.Tests (2)
KeycloakPublicApiTests.cs (2)
161var keycloakResource = builder.Resources.Single(r => r.Name.Equals(resourceName, StringComparison.Ordinal)); 186var keycloakResource = builder.Resources.Single(r => r.Name.Equals(resourceName, StringComparison.Ordinal));
Aspire.Hosting.Kubernetes (71)
Deployment\HelmDeploymentEngine.cs (5)
525var endpoints = await GetServiceEndpointsAsync(computeResource.Name.ToServiceName(), @namespace, environment.KubeConfigPath, context.Logger, context.CancellationToken).ConfigureAwait(false); 530context.Summary.Add(computeResource.Name, endpointText); 531context.Logger.LogInformation("Resource {ResourceName}: {Endpoints}", computeResource.Name, endpointText); 535context.Logger.LogDebug("No external endpoints found for {ResourceName}", computeResource.Name); 540context.Logger.LogWarning(ex, "Failed to retrieve endpoints for {ResourceName}", computeResource.Name);
Extensions\EndpointRoutingValidation.cs (1)
51$"Resource '{endpoint.Resource.Name}' endpoint '{endpoint.EndpointName}' is not marked as external " +
Extensions\ResourceExtensions.cs (9)
20Name = resource.Name.ToDeploymentName(), 49Name = resource.Name.ToStatefulSetName(), 74Name = resource.Name.ToSecretName(), 108Name = resource.Name.ToConfigMapName(), 140Name = resource.Name.ToServiceName(), 299Name = resource.Name, 409Name = context.TargetResource.Name.ToConfigMapName(), 426Name = context.TargetResource.Name.ToSecretName(), 464var pvcName = context.TargetResource.Name.ToPvcName(volume.Name);
KubernetesEnvironmentContext.cs (2)
22logger.LogInformation("Creating Kubernetes resource for {ResourceName}", resource.Name); 24var serviceResource = new KubernetesResource(resource.Name, resource, environment);
KubernetesEnvironmentExtensions.cs (7)
56throw new InvalidOperationException($"Resource '{r.Name}' is configured to publish as a Kubernetes service, but there are no '{nameof(KubernetesEnvironmentResource)}' resources or Kubernetes-backed compute environments. Ensure you have added one by calling '{nameof(AddKubernetesEnvironment)}'."); 117$"Resource '{resource.Name}' cannot resolve the '{environmentVariableName}' persistent-volume path in run mode. " + 150$"Resource '{resourceGroup.Key.Name}' binds {volumes.Length} different Kubernetes persistent volumes named '{nameGroup.Key}' (from environments {environmentNames}). " + 186var resourceNames = string.Join(", ", containers.Concat(hostProcesses).Select(item => $"'{item.Resource.Name}'")); 240var targetName = targetEnvironment?.Name ?? "<none>"; 241var supportedTargetName = (volumeEnvironment.OwningComputeEnvironment ?? volumeEnvironment).Name; 243$"Resource '{resource.Name}' is assigned to compute environment '{targetName}' but binds " +
KubernetesEnvironmentResource.cs (9)
405return ReferenceExpression.Create($"{resource.Name.ToServiceName()}"); 567context.EnvironmentVariables[KnownOtelConfigNames.ServiceName] = resource.Name; 938ingressName, targetResource.Name); 947ingressName, endpointName, targetResource.Name); 955Name = k8sResource.Service?.Metadata.Name ?? targetResource.Name.ToServiceName(), 1284gatewayName, targetResource.Name); 1293gatewayName, endpointName, targetResource.Name); 1305Name = k8sResource.Service?.Metadata.Name ?? targetResource.Name.ToServiceName(), 2216tlsSecret.Owner.Name);
KubernetesPersistentVolumeExtensions.cs (1)
509$"Resource '{builder.Resource.Name}' does not support environment variables and cannot use the '{env}' volume path variable.");
KubernetesPublishingContext.cs (12)
95var resourceDockerfilePath = Path.Combine(OutputPath, $"{serviceResource.TargetResource.Name}.Dockerfile"); 215var resourceKey = resource.Name.ToHelmValuesSectionName(); 245$"Resource '{resource.Name}' maps both {origins[valuesKey]} and {origin} " + 283resource.Name.ToHelmValuesSectionName(), 311captured.ResourceKey == resource.Name.ToHelmValuesSectionName() && 317resource.Name.ToHelmValuesSectionName(), 336resource.Name.ToHelmValuesSectionName(), 358?? throw new InvalidOperationException($"Container image for resource '{imageResource.Name}' could not be resolved during publish."); 364resource.Name.ToHelmValuesSectionName(), 372helmSection[resource.Name.ToHelmValuesSectionName()] = paramValues; 388var templatesFolder = Path.Combine(OutputPath, "templates", resource.Name); 393var fileName = GetFilename(resource.Name, templatedItem);
KubernetesResource.cs (21)
36Name = $"print-{resource.Name}-summary", 37Description = $"Retrieves deployment status for {resource.Name}.", 162["app.kubernetes.io/component"] = resource.Name, 206var imageEnvName = $"{resourceInstance.Name.ToHelmValuesSectionName()}_image"; 207var value = $"{resourceInstance.Name}:latest"; 208var expression = new HelmValue(imageEnvName.ToHelmParameterExpression(resource.Name), value) 254EndpointMappings[endpoint.Name] = new(endpoint.UriScheme, GetKubernetesProtocolName(endpoint.Protocol), resource.Name.ToServiceName(), httpMapping.Port, endpoint.Name); 274EndpointMappings[endpoint.Name] = new(endpoint.UriScheme, GetKubernetesProtocolName(endpoint.Protocol), resource.Name.ToServiceName(), HelmValue.Literal(portValue), endpoint.Name, ServicePort: servicePort); 285paramName.ToHelmParameterExpression(resource.Name), 289EndpointMappings[endpoint.Name] = new(endpoint.UriScheme, GetKubernetesProtocolName(endpoint.Protocol), resource.Name.ToServiceName(), helmValue, endpoint.Name); 428ProcessEnvironmentStringValue(stringValue, key, resource.Name); 431ProcessEnvironmentDefaultValue(value, key, resource.Name); 474Secrets[key] = new(key.ToHelmSecretExpression(TargetResource.Name), secretValue); 674var paramExpression = formattedName.ToHelmParameterExpression(TargetResource.Name); 759var resourceKey = TargetResource.Name.ToHelmValuesSectionName(); 762$"Resource '{TargetResource.Name}' maps multiple distinct {sourceKind} sources named '{parameter.Name}' " + 826formattedName.ToHelmSecretExpression(resource.Name) : 827formattedName.ToHelmConfigExpression(resource.Name); 849formattedName.ToHelmSecretExpression(resource.Name) : 850formattedName.ToHelmConfigExpression(resource.Name); 893var helmExpression = key.ToHelmConfigExpression(TargetResource.Name);
src\Shared\ResourceNameComparer.cs (3)
17return x.Name.Equals(y.Name, StringComparison.Ordinal); 21obj?.Name.GetHashCode(StringComparison.Ordinal) ?? 0;
src\Shared\VolumeMountPathResolver.cs (1)
34GetStablePathSegment(resource.Name),
Aspire.Hosting.Kubernetes.Tests (7)
KubernetesDeployTests.cs (1)
1185c.Resource.Name == "api");
KubernetesEnvironmentResourceTests.cs (6)
169var containerK8sResource = model.Resources.First(r => r.Name == "containerk8s"); 175var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker"); 181var projectK8sResource = model.Resources.First(r => r.Name == "projectk8s"); 187var projectDockerResource = model.Resources.First(r => r.Name == "projectdocker"); 248var containerK8sResource = model.Resources.First(r => r.Name == "containerk8s"); 249var containerDockerResource = model.Resources.First(r => r.Name == "containerdocker");
Aspire.Hosting.Maui (31)
Lifecycle\MauiBuildQueueEventSubscriber.cs (26)
86if (_nextStartSignals.TryGetValue(resource.Name, out var nextStartSignal)) 100queueAnnotation.ResourceCancellations[resource.Name] = resourceCts; 123logger.LogInformation("Building project '{ProjectName}' for {ResourceName}.", parent.Name, resource.Name); 152logger.LogInformation("Build cancelled for resource '{ResourceName}'.", resource.Name); 160logger.LogDebug("Released build lock (resource '{ResourceName}').", resource.Name); 163queueAnnotation.ResourceCancellations.TryRemove(resource.Name, out _); 174logger.LogWarning("No build info annotation found for resource '{ResourceName}'. Startup cannot proceed.", resource.Name); 176$"Resource '{resource.Name}' is missing MauiBuildInfoAnnotation. " + 236$"Build for resource '{resource.Name}' timed out after {BuildTimeout:c}."); 253$"Build failed for resource '{resource.Name}' with exit code {process.ExitCode}."); 256logger.LogInformation("Build succeeded for resource '{ResourceName}'.", resource.Name); 325resource.Name, 333resource.Name, 341logger.LogWarning(ex, "Timed out waiting for resource '{ResourceName}' to reach a launch handoff state after {Timeout}; releasing build lock.", resource.Name, LaunchHandoffTimeout); 348logger.LogWarning(ex, "Timed out waiting for Android resource '{ResourceName}' to finish its launch work after {Timeout}; stopping the resource before releasing the build lock.", resource.Name, LaunchHandoffTimeout); 355logger.LogError("Failed to stop Android resource '{ResourceName}' after its launch handoff timed out. Holding the build lock until the launch terminates, a replacement start takes over, or the application stops.", resource.Name); 371logger.LogError(stopException, "Failed to stop Android resource '{ResourceName}' after its launch handoff timed out. The build lock will remain held until the application stops.", resource.Name); 377logger.LogDebug("Application stopping while waiting for MAUI resource '{ResourceName}' to reach a launch handoff state; releasing build lock.", resource.Name); 381logger.LogWarning(ex, "Failed to wait for resource '{ResourceName}' to reach a stable state; releasing build lock.", resource.Name); 386.Remove(new(resource.Name, nextStartSignal)); 391logger.LogDebug("Released build lock (resource '{ResourceName}').", resource.Name); 404resource.Name, 542var wasCancelled = !_isLaunchTimeoutStop.Value && queueAnnotation.CancelResource(resource.Name); 559resource.Name, 573if (queueAnnotation.ResourceCancellations.ContainsKey(resource.Name)) 597logger.LogDebug(ex, "Failed to override state to Exited for resource '{ResourceName}'.", resource.Name);
MauiOtlpExtensions.cs (3)
139string.Equals(resource.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 268if (!string.Equals(resource.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName) || resource is not IResourceWithEndpoints dashboardResource) 409var resourceName = endpointReference.Resource.Name;
Utilities\MauiEnvironmentHelper.cs (2)
59var sanitizedName = SanitizeFileName(resource.Name + "-android"); 200var sanitizedName = SanitizeFileName(resource.Name + "-ios");
Aspire.Hosting.Maui.Tests (26)
MauiBuildQueueTests.cs (21)
131if (evt.Resource.Name == env.MacCatalyst.Name && evt.Snapshot.State?.Text == "Queued") 165if (evt.Resource.Name == env.Android.Name && evt.Snapshot.State?.Text == "Building") 1165if (evt.Resource.Name == resource.Name && evt.Snapshot.State?.Text == state) 1209return GetOrCreateStarted(resource.Name).Task.DefaultTimeout(timeout ?? TimeSpan.FromSeconds(30)); 1215GetOrCreateCompletion(resource.Name).TrySetResult(); 1221GetOrCreateCompletion(resource.Name).TrySetResult(); 1226return _releaseOnRunningValues[resource.Name]; 1231return _launchCancellationTokens[resource.Name]; 1237_buildFailures[resource.Name] = new InvalidOperationException(message); 1238GetOrCreateCompletion(resource.Name).TrySetResult(); 1244_buildFailures[resource.Name] = exception; 1245GetOrCreateCompletion(resource.Name).TrySetResult(); 1252GetOrCreateStarted(resource.Name).TrySetResult(); 1257var tcs = GetOrCreateCompletion(resource.Name); 1262GetOrCreateStarted(resource.Name).TrySetResult(); 1267if (_buildFailures.TryRemove(resource.Name, out var ex)) 1275_buildCompletions.TryRemove(resource.Name, out _); 1276_buildStarted.TryRemove(resource.Name, out _); 1285_launchCancellationTokens[resource.Name] = cancellationToken; 1292_releaseOnRunningValues[resource.Name] = releaseOnRunning;
MauiPlatformExtensionsTests.cs (4)
108Assert.Equal(config.ExpectedDefaultName, platform.Resource.Name); 131Assert.Equal(customName, platform.Resource.Name); 266Assert.NotEqual(platform1.Resource.Name, platform2.Resource.Name);
MauiWithArgsTests.cs (1)
235Assert.True(args.Count > 0, $"Expected args for {builder.Resource.Name}");
Aspire.Hosting.Milvus.Tests (2)
AddMilvusTests.cs (2)
28Assert.Equal("my-milvus", containerResource.Name); 58Assert.Equal("my-milvus", containerResource.Name);
Aspire.Hosting.MongoDB.Tests (1)
SingleMemberReplicaSetTests.cs (1)
31Assert.Equal(["mongo", "orders"], builder.Resources.Where(r => r is not ParameterResource).Select(r => r.Name));
Aspire.Hosting.MySql (2)
MySqlBuilderExtensions.cs (2)
347context.EnvironmentVariables["PMA_HOST"] = $"{endpoint.Resource.Name}:{endpoint.TargetPort}"; 497writer.WriteLine($"$cfg['Servers'][$i]['host'] = '{endpoint.Resource.Name}:{endpoint.TargetPort}';");
Aspire.Hosting.MySql.Tests (4)
AddMySqlTests.cs (4)
86Assert.Equal("mysql", containerResource.Name); 258var myAdmin = builder.Resources.Single(r => r.Name.Equals("phpmyadmin")); 264var container = builder.Resources.Single(r => r.Name == "phpmyadmin"); 290var myAdmin = builder.Resources.Single(r => r.Name.Equals("phpmyadmin"));
Aspire.Hosting.OpenAI.Tests (5)
OpenAIExtensionTests.cs (5)
209Assert.NotNull(builder.Resources.FirstOrDefault(r => r.Name == "openai-openai-apikey")); 214Assert.Null(builder.Resources.FirstOrDefault(r => r.Name == "openai-openai-apikey")); 215Assert.NotNull(builder.Resources.FirstOrDefault(r => r.Name == "secret-key1")); 219Assert.NotNull(builder.Resources.FirstOrDefault(r => r.Name == "secret-key1")); 220Assert.NotNull(builder.Resources.FirstOrDefault(r => r.Name == "secret-key2"));
Aspire.Hosting.Oracle.Tests (3)
AddOracleTests.cs (3)
45Assert.Equal("orcl", containerResource.Name); 84Assert.Equal("orcl", containerResource.Name); 166Assert.Equal("oracle", containerResource.Name);
Aspire.Hosting.Orleans (4)
OrleansServiceExtensions.cs (3)
143=> WithGrainStorage(orleansServiceBuilder, provider.Resource.Name, provider); 200=> WithStreaming(orleansServiceBuilder, provider.Resource.Name, provider); 328=> WithGrainDirectory(orleansServiceBuilder, provider.Resource.Name, provider);
ProviderConfiguration.cs (1)
49var serviceKey = resourceBuilder.Resource.Name;
Aspire.Hosting.PostgreSQL (2)
PostgresBuilderExtensions.cs (2)
95if (builder.Resources.FirstOrDefault(n => string.Equals(n.Name, name, StringComparisons.ResourceName)) is PostgresDatabaseResource postgreDatabase) 741writer.WriteString("Host", endpoint.Resource.Name);
Aspire.Hosting.PostgreSQL.Tests (8)
AddPostgresTests.cs (8)
56Assert.Equal("myPostgres", containerResource.Name); 110Assert.Equal("myPostgres", containerResource.Name); 226Assert.Equal("postgres", containerResource.Name); 405var container = builder.Resources.Single(r => r.Name == "pgadmin"); 481var container = builder.Resources.Single(r => r.Name == "pgadmin"); 494Assert.Single(builder.Resources, r => r.Name.Equals("pgadmin")); 515var pgadmin = builder.Resources.Single(r => r.Name.Equals("pgadmin")); 580var pgweb = builder.Resources.Single(r => r.Name.Equals("pgweb"));
Aspire.Hosting.Qdrant (1)
QdrantBuilderExtensions.cs (1)
177connectionName ??= resource.Name;
Aspire.Hosting.Qdrant.Tests (4)
AddQdrantTests.cs (3)
55Assert.Equal("my-qdrant", containerResource.Name); 94Assert.Equal("my-qdrant", containerResource.Name); 127Assert.Equal("my-qdrant", containerResource.Name);
QdrantFunctionalTests.cs (1)
234var qdrantResource = builder.Resources.Single(r => r.Name.Equals("qdrant"));
Aspire.Hosting.Radius (99)
Publishing\RadiusInfrastructureBuilder.cs (90)
383var identifier = BicepPostProcessor.SanitizeIdentifier(resource.Name); 391identifier, resource.Name, resourceType, apiVersion, 394_typeInstancesByResourceName[resource.Name] = typeInstance; 395_radiusTypeByResourceName[resource.Name] = resourceType; 416var identifier = BicepPostProcessor.SanitizeIdentifier(resource.Name); 419WarnIfImageMayNotPull(resource.Name, image); 431identifier, resource.Name, image, appConstruct!, envConstruct, connectionTargets, env, ports); 447containerPortSnapshots[resource.Name] = ports.ToDictionary( 618.Where(owner => _typeInstancesByResourceName.TryGetValue(owner.Name, out var construct) && 1704if (!seen.Add(resource.Name)) 2077$".NET program resource '{resource.Name}' cannot be published to Radius because no container image " + 2088return $"{resource.Name}:latest"; 2123if (!_radiusTypeByResourceName.TryGetValue(resource.Name, out var radiusType) || 2146$"Resource '{resource.Name}' is emitted as Radius type '{radiusType}', for which Aspire has no " + 2153!_typeInstancesByResourceName.TryGetValue(resource.Name, out var construct)) 2227$"A password was supplied for '{resource.Name}', but the Radius recipe that provisions it deploys the " + 2229$"applied, so '{resource.Name}' would be deployed unauthenticated while its consumers are handed an " + 2231$"'{resource.Name}' yourself if the deployed workload must require one. Diagnostic: ASPIRERADIUS085."); 2250resource.Name, 2252resource.Name); 2318.Where(d => referencedResourceNames.Contains(d.Name) || 2319_resolvedConnectionStringConsumption.Contains(d.Name)) 2320.Select(d => d.Name) 2333resource.Name, 2363.Where(d => referencedResourceNames.Contains(d.Name) || 2364_resolvedConnectionStringConsumption.Contains(d.Name)) 2375$"Resource '{resource.Name}' has a Radius recipe that provisions the single database " + 2426$"'{resource.Name}'. Its Radius recipe generates a separate value for each, and a single parameter " + 2492$"'{resource.Name}'. Give the user name and the password their own parameters. " + 2512$"Resource '{resource.Name}' is emitted as a Radius type that requires '{requiredProperty}' as a " + 2513$"schema property, but '{resource.Name}' exposes no '{requiredProperty}' connection property for " + 2542resource.Name); 2549var referenced = databaseChildren.Where(d => referencedResourceNames.Contains(d.Name)).ToList(); 2566$"Resource '{resource.Name}' has {referencedDatabaseNames.Count} referenced databases " + 2589$"Resource '{resource.Name}' declares {distinctDatabaseNames.Count} databases " + 2612if (referencedResourceNames.Contains(resource.Name)) 2619resource.Name, 2620databaseChild.Name, 2621resource.Name); 2629resource.Name, 2677$"Resource '{resource.Name}' is emitted as a Radius type whose credential requires a " + 2702$"Resource '{resource.Name}' is emitted as a Radius type that requires '{propertyName}', but " + 2703$"'{resource.Name}' exposes no '{propertyName}' connection property for Aspire to supply it, so the " + 2713var secretIdentifier = BicepPostProcessor.SanitizeIdentifier($"{resource.Name}_{propertyName}_secret"); 2716SecretName = BuildKubernetesSecretName($"{resource.Name}-{propertyName}-secret"), 2765$"'{resource.Name}'. Give the user name and the password their own parameters. " + 2771_radiusTypeByResourceName[resource.Name], 2791$"Resource '{resource.Name}' is emitted as a Radius type that requires 'username' as a schema property, " + 2792$"but '{resource.Name}' exposes no 'username' connection property for Aspire to supply it, so the " + 2866$"Resource '{resource.Name}' would be deployed with the user name 'guest', which RabbitMQ restricts to " + 2868$"explicit user name, for example AddRabbitMQ(\"{resource.Name}\", userName: builder.AddParameter(\"{resource.Name}user\")), " + 2929referenced.Add(relationship.Resource.Name); 2965resource.Name); 2998resource.Name, 3000owner.Owner.Name); 3121Add(relationship.Resource, relationship.Resource.Name); 3220: child.Name; 3268$"The '{key}' connection property of Radius resource '{resource.Name}' could not be resolved at publish " + 3346if (!_typeInstancesByResourceName.TryGetValue(resource.Name, out var construct) || 3347!_radiusTypeByResourceName.TryGetValue(resource.Name, out var radiusType)) 3354$"Resource '{resource.Name}' is deployed by a Radius recipe in a different environment than '{_environment.Name}', " + 3355$"so its address cannot be resolved here. Deploy the consumer and '{resource.Name}' to the same Radius environment. " + 3363$"Resource '{resource.Name}' maps to Radius type '{radiusType}', which does not expose an address Aspire can " + 3402$"The endpoint property '{property}' is not supported for Radius backing resource '{resource.Name}'. " + 3415$"Radius type '{radiusType}' used for resource '{resource.Name}' does not publish a host output, " + 3429$"Radius type '{radiusType}' used for resource '{resource.Name}' does not publish a port output, " + 3472$"Endpoint '{endpointReference.EndpointName}' of resource '{resource.Name}' is TLS-enabled, but the Radius " + 3474$"describe how '{resource.Name}' runs locally rather than how the recipe deploys it. Remove the TLS " + 3508$"Resource '{resource.Name}' is provisioned by a Radius recipe as '{radiusType}', which publishes a single " + 3512$"'{resource.Name}' as a container. Diagnostic: ASPIRERADIUS077."); 3538if (radiusResources.Any(p => p.Name == referencedResource.Name) 3539&& typeInstancesByResourceName.TryGetValue(referencedResource.Name, out var targetConstruct)) 3541connections[referencedResource.Name] = targetConstruct; 3707key, resource.Name, ex.Message); 3740resource.Name, 3759resource.Name, 3831$"Environment variable '{envVarName}' on resource '{resource.Name}' holds a credential, so it is " + 3868$"Container '{resource.Name}' has environment variables holding credentials, which are published as a " + 3874BicepPostProcessor.SanitizeIdentifier($"{resource.Name}_env_secret")) 3876SecretName = BuildKubernetesSecretName($"{resource.Name}-env-secret"), 3889resource.Name, 4250_resolvedConnectionStringConsumption.Add(consumed.Name); 4289if (string.Equals(owner.Name, childName, StringComparison.Ordinal)) 4313_radiusTypeByResourceName.ContainsKey(parent.Name)) 4315expressions[child.ConnectionStringExpression.ValueExpression] = child.Name; 4337$"'{endpointReference.Resource.Name}'"); 4599$"Parameter '{parameter.Name}' is used as the credential of both '{existing.Owner.Name}' and '{owner.Name}', " +
Publishing\RadiusServiceDiscovery.cs (1)
46public static string GetServiceName(IResource resource) => GetServiceName(resource.Name);
RadiusEnvironmentResource.cs (5)
256$"Endpoint '{endpointReference.EndpointName}' of resource '{resource.Name}' is TLS-enabled, but the Radius " + 258$"describe how '{resource.Name}' runs locally rather than how the recipe deploys it. Remove the TLS " + 298$"Endpoints of '{resource.Name}' cannot be resolved because it is provisioned by a Radius recipe rather " + 302$"or Azure App Service, a consumer there cannot reach '{resource.Name}' through the Radius environment: " + 303$"deploy '{resource.Name}' to the same compute environment as its consumer, or supply the address " +
RadiusInfrastructure.cs (1)
114resource.Name,
ResourceMapping\ResourceTypeMapper.cs (2)
158resource.Name, 173resource.Name,
Aspire.Hosting.Radius.Tests (12)
InnerLoop\GracefulDegradationTests.cs (2)
35var apiResource = model.Resources.First(r => r.Name == "api"); 90var apiResource = model.Resources.First(r => r.Name == "api");
InnerLoop\MultiEnvironmentTests.cs (3)
67var apiResource = model.Resources.First(r => r.Name == "api"); 93var allResourceNames = model.Resources.Select(r => r.Name).ToArray(); 96var apiResource = model.Resources.First(r => r.Name == "api");
InnerLoop\RadiusInfrastructureInitializationTests.cs (4)
29var apiResource = model.Resources.First(r => r.Name == "api"); 68var paramResource = model.Resources.First(r => r.Name == "my-param"); 86var apiResource = model.Resources.First(r => r.Name == "api"); 103var projectResource = model.Resources.First(r => r.Name == "webapp");
Publishing\BackingResourceContractTests.cs (1)
178Assert.Equal("pg", ex.Resource.Name);
Publishing\BackingResourceProjectionTests.cs (1)
180Assert.Equal("cache", ex.Resource.Name);
RadiusEnvironmentResourceTests.cs (1)
127Assert.Equal("cache", ex.Resource.Name);
Aspire.Hosting.Redis.Tests (6)
AddRedisTests.cs (6)
265var redisinsight = builder.Resources.Single(r => r.Name.Equals("redisinsight")); 309Assert.Equal(insight.Name, managementUrl.Endpoint?.Resource.Name); 335Assert.Equal(commander.Name, managementUrl.Endpoint?.Resource.Name); 561var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander")); 587var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander")); 608var commander = builder.Resources.Single(r => r.Name.Equals("rediscommander"));
Aspire.Hosting.RemoteHost.Tests (1)
CapabilityDispatcherTests.cs (1)
2445$"Endpoint with name 'http' already exists on resource '{builder.Resource.Name}'. Endpoint name may not have been explicitly specified and was derived automatically from scheme argument (e.g. 'http', 'https', or 'tcp'). Multiple calls to WithEndpoint (and related methods) may result in a conflict if name argument is not specified. Each endpoint must have a unique name. For more information on networking in Aspire see: https://aka.ms/aspire/networking");
Aspire.Hosting.Testing.Tests (2)
tests\Aspire.Hosting.TestUtilities\Utils\LoggerNotificationExtensions.cs (2)
36await rns.WaitForResourceHealthyAsync(resource.Resource.Name, cancellationToken); 134if (resourceName != null && !string.Equals(resourceEvent.Resource.Name, resourceName, StringComparison.OrdinalIgnoreCase))
Aspire.Hosting.Tests (73)
ApplicationModel\Docker\DockerfileBuilderCallbackContextTests.cs (1)
132Assert.Equal("mycontainer", context.Resource.Name);
ApplicationModel\ResourceCollectionTests.cs (1)
233Assert.Equal("test", result.Name);
Backchannel\AuxiliaryBackchannelRpcTargetTests.cs (1)
2164var dashboard = Assert.Single(model.Resources, r => r.Name == KnownResourceNames.AspireDashboard);
ComputeEnvironmentEndpointResolverTests.cs (1)
161ReferenceExpression.Create($"{endpointReference.Resource.Name}.example.com");
ComputeEnvironmentValidationTests.cs (1)
110ReferenceExpression.Create($"{endpointReference.Resource.Name}.example.com");
Dashboard\DashboardEventHandlersTests.cs (7)
55var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 104var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 196var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 276var dashboardResource = (IResourceWithEndpoints)model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 481var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 564var dashboardResource = model.Resources.Single(r => string.Equals(r.Name, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName)); 638Assert.Equal(KnownResourceNames.AspireDashboard, dashboardResource.Name);
Dashboard\DashboardResourceTests.cs (8)
94r => Assert.Equal("aspire-dashboard", r.Name), 95r => Assert.Equal("my-container", r.Name) 516var container = Assert.Single(model.Resources, r => r.Name == "my-container"); 520var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 562var container = Assert.Single(model.Resources, r => r.Name == "my-container"); 566var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 610var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard"); 642var dashboard = Assert.Single(model.Resources, r => r.Name == "aspire-dashboard");
Dcp\DcpExecutorTests.cs (20)
64if (context.Resource.Name == "program" && 131if (context.Resource.Name == "program") 227if (context.Resource.Name == "program") 3012if (context.Resource.Name == "database" && context.Status.State is not null) 3080if (context.Resource.Name == "program" && context.Status.State is not null) 3132if (context.Resource.Name == "database") 3185if (context.Resource.Name == "database") 3241if (context.Resource.Name == "database") 3459if (context.Resource.Name == "database") 4475if (@event.Resource.Name == "database") 4490if (context.Resource.Name == "database") 4500if (context.Resource.Name == "database") 4549if (context.Resource.Name == "database") 4713if (@event.Resource.Name == "database") 9649.Where(x => x.AppModelResourceName == resource.Name 9755failedResources.Add(context.Resource.Name); 10668.OrderBy(resource => resource.Name) 10832failedResources.Add(c.Resource.Name); 10869failedResources.Add(c.Resource.Name); 11581return new(new DcpResourceState(model.Resources.ToDictionary(r => r.Name), []));
DistributedApplicationBuilderTests.cs (1)
1403Assert.Contains(appBuilder.Resources, r => r.Name == longName);
DistributedApplicationTests.cs (1)
1360var aspireDashboard = model.Resources.Single(r => r.Name == KnownResourceNames.AspireDashboard);
Pipelines\DistributedApplicationPipelineTests.cs (6)
1050Assert.Equal("test-resource", capturedResource.Name); 1601var resource2Instance = configContext.Model.Resources.FirstOrDefault(r => r.Name == "resource2"); 1641var resource1Instance = configContext.Model.Resources.FirstOrDefault(r => r.Name == "resource1"); 1707capturedResource = configContext.Model.Resources.FirstOrDefault(r => r.Name == "test-resource"); 1715Assert.Equal("test-resource", capturedResource.Name); 2569var transient = model.Resources.Single(r => r.Name == "transient-resource");
ProjectResourceTests.cs (1)
992Assert.Equal("projectName", Assert.Single(imageManager.BuildImageResources).Name);
Publishing\DotnetProgramArchiveTests.cs (1)
494return pipeline.ExecuteStepSequentiallyAsync($"build-{resource.Name}", context);
Publishing\ResourceContainerImageManagerTests.cs (1)
1831context.LocalImageName = dockerfileAnnotation.ImageName ?? context.Resource.Name;
RequiredCommandAnnotationTests.cs (17)
153var resource = appModel.Resources.Single(r => r.Name == "test"); 169var resource = appModel.Resources.Single(r => r.Name == "test"); 187var resource = appModel.Resources.Single(r => r.Name == "test"); 212var resource = appModel.Resources.Single(r => r.Name == "test"); 239var resource = appModel.Resources.Single(r => r.Name == "test"); 263var resource = appModel.Resources.Single(r => r.Name == "test"); 284var resource = appModel.Resources.Single(r => r.Name == "test"); 304var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 305var resource2 = appModel.Resources.Single(r => r.Name == "test2"); 336var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 337var resource2 = appModel.Resources.Single(r => r.Name == "test2"); 371var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 372var resource2 = appModel.Resources.Single(r => r.Name == "test2"); 396var resource = appModel.Resources.Single(r => r.Name == "test"); 428var resource = appModel.Resources.Single(r => r.Name == "test"); 453var resource1 = appModel.Resources.Single(r => r.Name == "test1"); 454var resource2 = appModel.Resources.Single(r => r.Name == "test2");
ResourceExtensionsTests.cs (1)
452context.Options.RemoteImageName = $"myrepo/{context.Resource.Name}";
ResourceFailureLoggingTests.cs (1)
104var category = $"{builder.ApplicationBuilder.Environment.ApplicationName}.Resources.{builder.Resource.Name}";
ResourceNotificationTests.cs (2)
1566Assert.Equal(resource.Name, resourceEvent.Resource.Name); 1706Assert.True(notificationService.TryGetCurrentState(resourceBuilder.Resource.Name, out var resourceEvent));
WithHttpCommandTests.cs (1)
1068resource.Name,
Aspire.Hosting.TestUtilities (6)
Utils\LoggerNotificationExtensions.cs (2)
36await rns.WaitForResourceHealthyAsync(resource.Resource.Name, cancellationToken); 134if (resourceName != null && !string.Equals(resourceEvent.Resource.Name, resourceName, StringComparison.OrdinalIgnoreCase))
Utils\ManifestUtils.cs (2)
41var resourceNode = obj[resource.Name]; 88var resourceNode = obj[r.Name];
Utils\OtlpExporterActivationTestExtensions.cs (1)
16throw new InvalidOperationException($"Resource '{builder.Resource.Name}' does not have an OTLP exporter annotation.");
Utils\TerminalCommandTestHelpers.cs (1)
24ResourceName = resource.Name,
Aspire.Hosting.Yarp (5)
ConfigurationBuilder\YarpCluster.cs (5)
31: this(endpoint.Resource.Name, endpoint) 43return $"{endpoint.Scheme}://{endpoint.Resource.Name}"; 46return $"{endpoint.Scheme}://_{endpoint.EndpointName}.{endpoint.Resource.Name}"; 54: this(resource.Name, resource) 126var resourceName = resource.Name;
Aspire.Playground.Tests (4)
Infrastructure\DistributedApplicationExtensions.cs (2)
107return Task.WhenAll(applicationModel.Resources.Select(r => app.ResourceNotifications.WaitForResourceAsync(r.Name, r => targetStates?.Contains(r.Snapshot.State?.Text, StringComparer.OrdinalIgnoreCase) is true || r.Snapshot.IsHidden, cancellationToken))); 135var assertableResourceLogNames = applicationModel.Resources.Where(ShouldAssertErrorsForResource).Select(r => $"{environment.ApplicationName}.Resources.{r.Name}").ToList();
tests\Aspire.Hosting.TestUtilities\Utils\LoggerNotificationExtensions.cs (2)
36await rns.WaitForResourceHealthyAsync(resource.Resource.Name, cancellationToken); 134if (resourceName != null && !string.Equals(resourceEvent.Resource.Name, resourceName, StringComparison.OrdinalIgnoreCase))
Stress.AppHost (4)
CommandResources.cs (1)
1486.Where(r => r.Name != KnownResourceNames.AspireDashboard)
TestResource.cs (3)
43new(KnownProperties.Resource.ParentName, parent.Name) 60new(KnownProperties.Resource.ParentName, parent.Name) 77new(KnownProperties.Resource.ParentName, parent.Name)