2 implementations of IEnvironment
aspire (1)
HostEnvironment.cs (1)
12public sealed class HostEnvironment : IEnvironment
Aspire.Cli.Tests (1)
Utils\TestEnvironment.cs (1)
10internal sealed class TestEnvironment : IEnvironment
203 references to IEnvironment
aspire (155)
Acquisition\IdentityResolver.cs (4)
27/// Environment variables are read via <see cref="IEnvironment.GetEnvironmentVariable"/> 29/// depend on <see cref="IEnvironment"/> independently, avoiding a circular 63private readonly IEnvironment _environment; 73IEnvironment environment)
Acquisition\InstallationDiscovery.cs (2)
30private readonly IEnvironment _environment; 39IEnvironment environment,
Agents\Copilot\CopilotAgentEnvironmentScanner.cs (2)
25private readonly IEnvironment _environment; 42IEnvironment environment,
Agents\Copilot\CopilotAppInstallationDetector.cs (1)
24IEnvironment environment,
Agents\Copilot\CopilotPaths.cs (1)
20public static string GetConfigDirectory(DirectoryInfo homeDirectory, IEnvironment environment)
Agents\Hooks\AgentTelemetryHook.cs (1)
15internal sealed class AgentTelemetryHook(IEnvironment environment)
Agents\Hooks\TelemetryHookConfigurator.cs (2)
36private readonly IEnvironment _environment; 42IEnvironment environment,
Agents\VsCode\VsCodeAgentEnvironmentScanner.cs (2)
25private readonly IEnvironment _environment; 36public VsCodeAgentEnvironmentScanner(IVsCodeCliRunner vsCodeCliRunner, PlaywrightCliInstaller playwrightCliInstaller, CliExecutionContext executionContext, IEnvironment environment, ILogger<VsCodeAgentEnvironmentScanner> logger)
Backchannel\AppHostCliBackchannel.cs (1)
35IEnvironment environment,
Bundles\BundleService.cs (2)
24IEnvironment environment, 879internal static async Task ExtractPayloadAsync(Stream payloadStream, string destinationPath, IEnvironment environment, CancellationToken cancellationToken)
Caching\AppHostInfoDiskCache.cs (5)
31/// Tracked inputs (see <see cref="ComputeKeyAsync(FileInfo, IEnvironment, in DotNetAppHostProject.AppHostImportDependencies)"/>): 111private readonly IEnvironment _environment; 113public AppHostInfoDiskCache(ILogger<AppHostInfoDiskCache> logger, CliExecutionContext executionContext, IConfigurationService configurationService, IEnvironment environment) 289internal static string ComputeKeyAsync(FileInfo projectFile, IEnvironment environment) 292internal static string ComputeKeyAsync(FileInfo projectFile, IEnvironment environment, in DotNetAppHostProject.AppHostImportDependencies importDependencies)
Certificates\CertificateGeneration\CertificateManager.cs (1)
56public static CertificateManager Create(ILogger logger, IEnvironment environment, CertificateConfiguration.NssDbOverride? nssDbOverride) => environment.IsWindows() ?
Certificates\CertificateGeneration\UnixCertificateManager.cs (3)
45private readonly IEnvironment _environment; 49public UnixCertificateManager(ILogger logger, IEnvironment environment, CertificateConfiguration.NssDbOverride? nssDbOverride) : base(logger) 57IEnvironment environment,
Certificates\CertificateHelpers.cs (1)
47internal static string GetDevCertsTrustPath(IEnvironment environment)
Certificates\CertificateService.cs (1)
55IEnvironment environment,
Certificates\NativeCertificateToolRunner.cs (1)
19IEnvironment environment,
Commands\AgentTelemetryCommand.cs (2)
36private readonly IEnvironment _environment; 93AgentTelemetryHook hook, IEnvironment environment, ConsoleEnvironment console, IServiceProvider serviceProvider)
Commands\CompletionsCommand.cs (3)
14public CompletionsCommand(IEnvironment environment, CommonCommandServices services) 28private readonly IEnvironment _environment; 30public ScriptCommand(IEnvironment environment, CommonCommandServices services)
Commands\DashboardRunCommand.cs (8)
35private readonly IEnvironment _environment; 81IEnvironment environment, 181private static void AddOptionArgs(ParseResult parseResult, List<string> args, IReadOnlyList<string> unmatchedTokens, IEnvironment environment) 202IEnvironment environment, Option<string?> option, string envVarName, string? defaultValue) 220IEnvironment environment, Option<bool> option, string envVarName, bool? defaultValue = null) 244internal static bool ConfigSettingHasValue(IReadOnlyList<string> unmatchedTokens, IEnvironment environment, string envVarName) 275internal static DashboardInfo ResolveDashboardInfo(List<string> dashboardArgs, IReadOnlyList<string> unmatchedTokens, IEnvironment environment, string? browserToken) 296internal static string? ResolveSettingValue(List<string> args, IReadOnlyList<string> unmatchedTokens, IEnvironment environment, string key)
Commands\PsCommand.cs (2)
76private readonly IEnvironment _environment; 91IEnvironment environment,
Commands\StopCommand.cs (2)
28private readonly IEnvironment _environment; 64IEnvironment environment,
Commands\UpdateCommand.cs (3)
38private readonly IEnvironment _environment; 72IEnvironment environment, 934private static bool IsInPath(string directory, IEnvironment environment)
Completions\CompletionScripts.cs (1)
10internal static string? DetectShell(IEnvironment environment)
DotNet\DotNetCliRunner.cs (1)
188IEnvironment environment) : IDotNetCliRunner
DotNet\DotNetSdkInstaller.cs (3)
14internal sealed class DotNetSdkInstaller(IConfiguration configuration, IEnvironment environment) : IDotNetSdkInstaller 18internal DotNetSdkInstaller(IConfiguration configuration, IEnvironment environment, Func<string, string, ProcessStartInfo> createProcessStartInfo) 124internal static string ResolveDotNetPath(IEnvironment environment) =>
DotNet\ProcessExecution.cs (2)
30private readonly IEnvironment _hostEnvironment; 50IEnvironment hostEnvironment,
DotNet\ProcessExecutionFactory.cs (4)
24private readonly IEnvironment _environment; 30public ProcessExecutionFactory(IEnvironment environment, ILogger<ProcessExecutionFactory> logger) 36IEnvironment environment, 208IEnvironment environment,
Git\GitRepository.cs (1)
17internal sealed class GitRepository(CliExecutionContext executionContext, IEnvironment environment, ILogger<GitRepository> logger, ProfilingTelemetry profilingTelemetry) : IGitRepository
HostEnvironment.cs (1)
9/// Default <see cref="IEnvironment"/> that delegates to the process
Layout\LayoutDiscovery.cs (2)
40private readonly IEnvironment _environment; 42public LayoutDiscovery(ILogger<LayoutDiscovery> logger, IEnvironment environment)
Npm\NpmRunner.cs (2)
15internal sealed class NpmRunner(IEnvironment environment, ILogger<NpmRunner> logger, ProfilingTelemetry profilingTelemetry) : INpmRunner 206internal static ProcessStartInfo CreateNpmProcessStartInfo(string npmPath, string[] args, string workingDirectory, IEnvironment environment)
NuGet\NuGetClient.cs (2)
88IEnvironment environment, 698public static void Initialize(NuGetOperationOutput output, INuGetLogger diagnosticLogger, IEnvironment environment)
NuGet\NuGetSignatureVerificationEnabler.cs (2)
26public static void Apply(Dictionary<string, string> environmentVariables, IFeatures features, IEnvironment environment) 55public static IDisposable ApplyToCurrentProcess(IFeatures features, IEnvironment environment)
Processes\ProcessTreeGracefulShutdownService.cs (1)
23IEnvironment environment,
Program.cs (6)
383builder.Services.AddSingleton<IEnvironment, HostEnvironment>(); 386var environment = sp.GetRequiredService<IEnvironment>(); 423sp.GetRequiredService<IEnvironment>()); 491var environment = sp.GetRequiredService<IEnvironment>();
Projects\AppHostCandidateFinder.cs (1)
54IEnvironment environment,
Projects\AppHostRpcClient.cs (3)
41IEnvironment environment, 186private static async Task<Stream> ConnectToServerAsync(string socketPath, IEnvironment environment, CancellationToken cancellationToken) 255internal sealed class AppHostRpcClientFactory(IEnvironment environment) : IAppHostRpcClientFactory
Projects\AppHostServerProject.cs (1)
34IEnvironment environment,
Projects\AppHostServerSession.cs (4)
34private readonly IEnvironment _environment; 65IEnvironment environment, 468private readonly IEnvironment _environment; 472public AppHostServerSessionFactory(IEnvironment environment, ILogger<AppHostServerSession> logger, ProfilingTelemetry profilingTelemetry)
Projects\DotNetAppHostProject.cs (2)
56private readonly IEnvironment _environment; 87IEnvironment environment,
Projects\DotNetBasedAppHostServerProject.cs (2)
49private readonly IEnvironment _environment; 61IEnvironment environment,
Projects\GuestAppHostProject.cs (2)
58private readonly IEnvironment _environment; 82IEnvironment environment,
Projects\GuestRuntime.cs (3)
24private readonly IEnvironment _environment; 42IEnvironment environment, 59public GuestRuntime(RuntimeSpec spec, ILogger logger, Func<string, string?> commandResolver, IEnvironment environment, ProfilingTelemetry profilingTelemetry, FileLoggerProvider? fileLoggerProvider = null)
Projects\PrebuiltAppHostServer.cs (2)
59private readonly IEnvironment _environment; 97IEnvironment environment,
Projects\ProjectLocator.cs (1)
141IEnvironment environment,
Projects\TypeScriptAppHostToolchainResolver.cs (4)
43public static TypeScriptAppHostToolchain Resolve(DirectoryInfo appHostDirectory, IEnvironment environment, ILogger? logger) 54internal static TypeScriptAppHostToolchainResolution ResolveWithReason(DirectoryInfo appHostDirectory, IEnvironment environment) 480private static IEnumerable<DirectoryInfo> EnumerateCandidateDirectories(DirectoryInfo appHostDirectory, IEnvironment environment) 493internal static bool ShouldSearchParentDirectory(DirectoryInfo parentDirectory, IEnvironment environment, string? homeDirectory = null)
Scaffolding\ScaffoldingService.cs (3)
46private readonly IEnvironment _environment; 56IEnvironment environment, 336internal static IReadOnlyList<string> AddRootTypeScriptAppHostDelegateScripts(JsonObject scripts, DirectoryInfo appHostDirectory, string relativeAppHostDirectory, IEnvironment environment, ILogger? logger)
Telemetry\CIEnvironmentDetector.cs (2)
11private readonly IEnvironment _environment; 35public CIEnvironmentDetector(IEnvironment environment)
Telemetry\CodingAgentDetector.cs (3)
10internal sealed class CodingAgentDetector(IEnvironment environment) : ICodingAgentDetector 51private readonly IEnvironment _environment = environment; 80public bool IsMatch(IEnvironment environment)
Telemetry\InternalMicrosoftDetector.cs (3)
54private readonly IEnvironment _environment; 66public InternalMicrosoftDetector(CliExecutionContext executionContext, IEnvironment environment, TimeProvider timeProvider, ILogger<InternalMicrosoftDetector> logger, IProcessExecutionFactory processExecutionFactory, ICIEnvironmentDetector ciEnvironmentDetector) 82IEnvironment environment,
Telemetry\TelemetryServiceCollectionExtensions.cs (2)
22var environment = sp.GetRequiredService<IEnvironment>();
Templating\CliTemplateFactory.cs (2)
73private readonly IEnvironment _environment; 85IEnvironment environment,
Templating\DotNetTemplateFactory.cs (1)
30IEnvironment environment)
Utils\ArchiveHelper.cs (2)
18internal static async Task ExtractAsync(string archivePath, string destinationPath, IEnvironment environment, CancellationToken cancellationToken) 71private static async Task ExtractTarGzSafeAsync(string archivePath, string destinationPath, IEnvironment environment, CancellationToken cancellationToken)
Utils\CliDownloader.cs (1)
22IEnvironment environment,
Utils\CliPathHelper.cs (1)
168internal static string NormalizePathCasing(string path, IEnvironment environment)
Utils\EnvironmentChecker\ContainerRuntimeCheck.cs (1)
12internal sealed class ContainerRuntimeCheck(ILogger<ContainerRuntimeCheck> logger, IEnvironment environment) : IEnvironmentCheck
Utils\EnvironmentChecker\DcpConnectionChecker.cs (3)
27IEnvironment environment, 224IEnvironment environment, 410private static void AddDeveloperCertificateArguments(List<string> arguments, CertificateManager certificateManager, IEnvironment environment)
Utils\EnvironmentChecker\DeprecatedWorkloadCheck.cs (2)
17internal sealed class DeprecatedWorkloadCheck(ILogger<DeprecatedWorkloadCheck> logger, IEnvironment environment) : IEnvironmentCheck 24internal DeprecatedWorkloadCheck(ILogger<DeprecatedWorkloadCheck> logger, IEnvironment environment, Func<ProcessStartInfo, Process?> startProcess)
Utils\EnvironmentChecker\DevCertsCheck.cs (6)
20internal sealed class DevCertsCheck(ILogger<DevCertsCheck> logger, ICertificateToolRunner certificateToolRunner, IEnvironment environment, IProcessExecutionFactory processExecutionFactory) : IEnvironmentCheck 71IReadOnlyList<DevCertInfo> certInfos, IEnvironment environment) 219private async Task AddLinuxOpenSslCertificateCacheWarningsAsync(List<EnvironmentCheckResult> results, IReadOnlyList<DevCertInfo> certInfos, IEnvironment environment, CancellationToken cancellationToken) 491private static void AddLinuxCertificateToolWarnings(List<EnvironmentCheckResult> results, IEnvironment environment) 517private static Dictionary<string, string> GetEnvironmentVariables(IEnvironment environment) => 561private static string BuildSslCertDirFixCommand(string devCertsTrustPath, IEnvironment environment)
Utils\EnvironmentChecker\OperatingSystemCheck.cs (2)
21public OperatingSystemCheck(IEnvironment environment) 56internal static OperatingSystemDetails GetCurrentOperatingSystemDetails(IEnvironment environment)
Utils\EnvironmentChecker\TypeScriptAppHostToolingCheck.cs (3)
21private readonly IEnvironment _environment; 30IEnvironment environment, 47IEnvironment environment,
Utils\EnvironmentChecker\VsCodeExtensionCheck.cs (8)
31private readonly IEnvironment _environment; 35public VsCodeExtensionCheck(IEnvironment environment, CliExecutionContext executionContext) 42internal VsCodeExtensionCheck(IEnvironment environment, CliExecutionContext executionContext, Func<string, string?> commandResolver) 100internal static VsCodeExtensionDetection Detect(IEnvironment environment, DirectoryInfo homeDirectory) 107internal static VsCodeExtensionDetection Detect(IEnvironment environment, DirectoryInfo homeDirectory, Func<string, string?> commandResolver) 119private static bool IsVsCodeInstalled(IEnvironment environment, Func<string, string?> commandResolver) 133private static bool IsExtensionInstalled(IEnvironment environment, DirectoryInfo homeDirectory) 146private static IEnumerable<string> GetExtensionDirectories(IEnvironment environment, DirectoryInfo homeDirectory)
Utils\EnvironmentChecker\WslEnvironmentCheck.cs (3)
19private readonly IEnvironment _environment; 22public WslEnvironmentCheck(IEnvironment environment) 28internal WslEnvironmentCheck(IEnvironment environment, Func<string?> readProcVersion)
Utils\EnvironmentVariableExtensions.cs (1)
8internal static bool IsFlagEnabled(this IEnvironment environment, string name)
Utils\FileSystemHelper.cs (1)
144internal static Dictionary<string, string> ShortenPaths(IReadOnlyList<string> paths, IEnvironment environment)
Utils\MissingJavaScriptToolWarning.cs (2)
35public static string GetMessage(DirectoryInfo directory, LanguageInfo? language, IEnvironment environment) 41private static (string InstallCommand, string InstallDisplayName) GetMessageParts(DirectoryInfo directory, LanguageInfo? language, IEnvironment environment)
Aspire.Cli.Tests (48)
Agents\CopilotAppInstallationDetectorTests.cs (1)
135IEnvironment environment,
BundleServiceIntegrationTests.cs (1)
603/// Verifies that the static <see cref="BundleService.ExtractPayloadAsync(Stream, string, IEnvironment, CancellationToken)"/>
Certificates\CertificateServiceTests.cs (9)
204services.AddSingleton<IEnvironment>(TestEnvironment.CreateWindows()); 359services.AddSingleton<IEnvironment>(TestEnvironment.CreateWindows()); 400services.AddSingleton<IEnvironment>(TestEnvironment.CreateWindows()); 491services.AddSingleton<IEnvironment>(TestEnvironment.CreateWindows()); 529services.AddSingleton<IEnvironment>(TestEnvironment.CreateWindows()); 575services.AddSingleton<IEnvironment>(TestEnvironment.CreateWindows(envVars)); 609services.AddSingleton<IEnvironment>(TestEnvironment.CreateWindows()); 622private ServiceProvider CreateServiceProvider(TemporaryWorkspace workspace, TestCertificateToolRunner toolRunner, bool nonInteractive = false, IEnvironment? environment = null) 639return new CertificateService(toolRunner, interactiveService, telemetry, hostEnvironment, environment ?? sp.GetRequiredService<IEnvironment>(), executionContext, logger);
Commands\AgentTelemetryCommandTests.cs (1)
102services.AddSingleton<IEnvironment>(new TestEnvironment(new Dictionary<string, string?>
Commands\DashboardRunCommandTests.cs (10)
101var environment = CreateEnvironment(new Dictionary<string, string?> 115var environment = CreateEnvironment(new Dictionary<string, string?>()); 126var environment = CreateEnvironment(new Dictionary<string, string?>()); 554var environment = CreateEnvironment(new Dictionary<string, string?>()); 567var environment = CreateEnvironment(new Dictionary<string, string?> 584var environment = CreateEnvironment(new Dictionary<string, string?>()); 598var environment = CreateEnvironment(new Dictionary<string, string?> 616var environment = CreateEnvironment(new Dictionary<string, string?> 632var environment = CreateEnvironment(new Dictionary<string, string?>()); 727private static IEnvironment CreateEnvironment(Dictionary<string, string?> envVars)
DotNetSdkInstallerTests.cs (1)
304IEnvironment? environment = null,
NuGet\NuGetSignatureVerificationEnablerTests.cs (6)
13private static IEnvironment CreateEnvironment(Dictionary<string, string?>? envVars = null) 23var environment = CreateEnvironment(); 40var environment = CreateEnvironment(new Dictionary<string, string?>()); // empty env — no user override 58var environment = CreateEnvironment(new Dictionary<string, string?> 79var environment = CreateEnvironment(new Dictionary<string, string?> 100var environment = CreateEnvironment();
Processes\ProcessTreeGracefulShutdownServiceTests.cs (1)
322IEnvironment? environment = null)
Projects\DotNetAppHostProjectTests.cs (2)
4672IEnvironment? environment = null) 4690services.RemoveAll<IEnvironment>();
Projects\GuestAppHostProjectTests.cs (1)
1818IEnvironment? environment = null,
Projects\ProjectLocatorTests.cs (1)
4260IEnvironment? environment = null,
Telemetry\AspireCliTelemetryTests.cs (1)
739services.AddSingleton<IEnvironment>(new TestEnvironment(environmentVariables));
Telemetry\CIEnvironmentDetectorTests.cs (1)
156services.AddSingleton<IEnvironment>(environment);
Utils\CliTestHelper.cs (10)
230services.AddSingleton<IEnvironment, TestEnvironment>(); 486var environment = serviceProvider.GetRequiredService<IEnvironment>(); 547var environment = serviceProvider.GetRequiredService<IEnvironment>(); 561return new ScaffoldingService(appHostServerProjectFactory, serverSessionFactory, languageDiscovery, interactionService, serviceProvider.GetRequiredService<IEnvironment>(), logger, executionContext, serviceProvider.GetRequiredService<ProfilingTelemetry>()); 603var environment = serviceProvider.GetRequiredService<IEnvironment>(); 652var cliFactory = new CliTemplateFactory(languageDiscovery, projectFactory, scaffoldingService, prompter, executionContext, interactionService, hostEnvironment, serviceProvider.GetRequiredService<IEnvironment>(), templateNuGetConfigService, cliTemplateLogger); 691return new GitRepository(executionContext, serviceProvider.GetRequiredService<IEnvironment>(), logger, profilingTelemetry);
Utils\DevCertsCheckTests.cs (1)
57private static DevCertsCheck CreateCheck(TestCertificateToolRunner toolRunner, IEnvironment environment, TestProcessExecutionFactory? processExecutionFactory = null) =>
Utils\TestEnvironment.cs (1)
7/// Test <see cref="IEnvironment"/> backed by a dictionary so tests can inject