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
189 references to IEnvironment
aspire (143)
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\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, 868internal 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)
55public static CertificateManager Create(ILogger logger, IEnvironment environment) => environment.IsWindows() ?
Certificates\CertificateGeneration\UnixCertificateManager.cs (3)
48private readonly IEnvironment _environment; 51public UnixCertificateManager(ILogger logger, IEnvironment environment) : base(logger) 56internal UnixCertificateManager(ILogger logger, IEnvironment environment, Func<string, ProcessStartInfo> createCertUtilStartInfo)
Certificates\CertificateHelpers.cs (1)
47internal static string GetDevCertsTrustPath(IEnvironment environment)
Certificates\CertificateService.cs (1)
55IEnvironment environment,
Certificates\NativeCertificateToolRunner.cs (1)
19IEnvironment environment,
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; 56IEnvironment environment,
Commands\UpdateCommand.cs (3)
38private readonly IEnvironment _environment; 71IEnvironment environment, 880private static bool IsInPath(string directory, 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\BundleNuGetService.cs (2)
50private readonly IEnvironment _environment; 58IEnvironment environment,
NuGet\NuGetSignatureVerificationEnabler.cs (1)
22public static void Apply(Dictionary<string, string> environmentVariables, IFeatures features, IEnvironment environment)
Processes\ProcessTreeGracefulShutdownService.cs (1)
23IEnvironment environment,
Program.cs (5)
366builder.Services.AddSingleton<IEnvironment, HostEnvironment>(); 369var environment = sp.GetRequiredService<IEnvironment>(); 406sp.GetRequiredService<IEnvironment>()); 466builder.Services.AddSingleton(sp => CertificateManager.Create(sp.GetRequiredService<ILogger<NativeCertificateToolRunner>>(), 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)
33IEnvironment 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)
54private readonly IEnvironment _environment; 85IEnvironment environment,
Projects\DotNetBasedAppHostServerProject.cs (2)
49private readonly IEnvironment _environment; 60IEnvironment 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)
56private readonly IEnvironment _environment; 93IEnvironment 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\CodingAgentDetector.cs (3)
9internal sealed class CodingAgentDetector(IEnvironment environment) : ICodingAgentDetector 50private readonly IEnvironment _environment = environment; 79public 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\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 (46)
Agents\CopilotAppInstallationDetectorTests.cs (1)
135IEnvironment environment,
BundleServiceIntegrationTests.cs (1)
510/// 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\DashboardRunCommandTests.cs (10)
101var environment = CreateEnvironment(new Dictionary<string, string?> 115var environment = CreateEnvironment(new Dictionary<string, string?>()); 126var environment = CreateEnvironment(new Dictionary<string, string?>()); 498var environment = CreateEnvironment(new Dictionary<string, string?>()); 511var environment = CreateEnvironment(new Dictionary<string, string?> 528var environment = CreateEnvironment(new Dictionary<string, string?>()); 542var environment = CreateEnvironment(new Dictionary<string, string?> 560var environment = CreateEnvironment(new Dictionary<string, string?> 576var environment = CreateEnvironment(new Dictionary<string, string?>()); 663private static IEnvironment CreateEnvironment(Dictionary<string, string?> envVars)
DotNetSdkInstallerTests.cs (1)
304IEnvironment? environment = null,
NuGet\NuGetSignatureVerificationEnablerTests.cs (6)
12private static IEnvironment CreateEnvironment(Dictionary<string, string?>? envVars = null) 22var environment = CreateEnvironment(); 39var environment = CreateEnvironment(new Dictionary<string, string?>()); // empty env — no user override 57var environment = CreateEnvironment(new Dictionary<string, string?> 78var environment = CreateEnvironment(new Dictionary<string, string?> 99var environment = CreateEnvironment();
Processes\ProcessTreeGracefulShutdownServiceTests.cs (1)
322IEnvironment? environment = null)
Projects\DotNetAppHostProjectTests.cs (2)
4575IEnvironment? environment = null) 4593services.RemoveAll<IEnvironment>();
Projects\GuestAppHostProjectTests.cs (1)
1529IEnvironment? environment = null,
Projects\ProjectLocatorTests.cs (1)
4260IEnvironment? environment = null,
Telemetry\AspireCliTelemetryTests.cs (1)
739services.AddSingleton<IEnvironment>(new TestEnvironment(environmentVariables));
Utils\CliTestHelper.cs (10)
224services.AddSingleton<IEnvironment, TestEnvironment>(); 476var environment = serviceProvider.GetRequiredService<IEnvironment>(); 537var environment = serviceProvider.GetRequiredService<IEnvironment>(); 551return new ScaffoldingService(appHostServerProjectFactory, serverSessionFactory, languageDiscovery, interactionService, serviceProvider.GetRequiredService<IEnvironment>(), logger, executionContext, serviceProvider.GetRequiredService<ProfilingTelemetry>()); 591var environment = serviceProvider.GetRequiredService<IEnvironment>(); 639var cliFactory = new CliTemplateFactory(languageDiscovery, projectFactory, scaffoldingService, prompter, executionContext, interactionService, hostEnvironment, serviceProvider.GetRequiredService<IEnvironment>(), templateNuGetConfigService, cliTemplateLogger); 678return 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