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
183 references to IEnvironment
aspire (139)
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\CopilotCli\CopilotCliAgentEnvironmentScanner.cs (2)
25private readonly IEnvironment _environment; 36public CopilotCliAgentEnvironmentScanner(ICopilotCliRunner copilotCliRunner, PlaywrightCliInstaller playwrightCliInstaller, CliExecutionContext executionContext, IEnvironment environment, ILogger<CopilotCliAgentEnvironmentScanner> logger)
Agents\Hooks\TelemetryHookConfigurator.cs (2)
37private readonly IEnvironment _environment; 43IEnvironment 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)
47private readonly IEnvironment _environment; 50public UnixCertificateManager(ILogger logger, IEnvironment environment) : base(logger) 55internal 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; 71IEnvironment environment, 164private static void AddOptionArgs(ParseResult parseResult, List<string> args, IReadOnlyList<string> unmatchedTokens, IEnvironment environment) 183IEnvironment environment, Option<string?> option, string envVarName, string? defaultValue) 201IEnvironment environment, Option<bool> option, string envVarName, bool? defaultValue = null) 225internal static bool ConfigSettingHasValue(IReadOnlyList<string> unmatchedTokens, IEnvironment environment, string envVarName) 256internal static DashboardInfo ResolveDashboardInfo(List<string> dashboardArgs, IReadOnlyList<string> unmatchedTokens, IEnvironment environment, string? browserToken) 277internal 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)
27private readonly IEnvironment _environment; 55IEnvironment environment,
Commands\UpdateCommand.cs (3)
38private readonly IEnvironment _environment; 71IEnvironment environment, 880private static bool IsInPath(string directory, IEnvironment environment)
DotNet\DotNetCliRunner.cs (1)
181IEnvironment 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)
21private readonly IEnvironment _environment; 27public ProcessExecutionFactory(IEnvironment environment, ILogger<ProcessExecutionFactory> logger) 33IEnvironment environment, 205IEnvironment 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)
49private readonly IEnvironment _environment; 57IEnvironment 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, 182private static async Task<Stream> ConnectToServerAsync(string socketPath, IEnvironment environment, CancellationToken cancellationToken) 251internal 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)
53private readonly IEnvironment _environment; 84IEnvironment environment,
Projects\DotNetBasedAppHostServerProject.cs (2)
49private readonly IEnvironment _environment; 60IEnvironment environment,
Projects\GuestAppHostProject.cs (2)
56private readonly IEnvironment _environment; 80IEnvironment environment,
Projects\GuestRuntime.cs (2)
24private readonly IEnvironment _environment; 36public 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 (3)
140IEnvironment environment, 613internal static bool IsUnderDirectory(FileInfo file, DirectoryInfo directory, IEnvironment environment) 1200internal static bool IsSamePersistedAppHostPath(string persistedPath, string selectedPath, IEnvironment environment)
Projects\TypeScriptAppHostToolchainResolver.cs (4)
39public static TypeScriptAppHostToolchain Resolve(DirectoryInfo appHostDirectory, IEnvironment environment, ILogger? logger) 50internal static TypeScriptAppHostToolchainResolution ResolveWithReason(DirectoryInfo appHostDirectory, IEnvironment environment) 404private static IEnumerable<DirectoryInfo> EnumerateCandidateDirectories(DirectoryInfo appHostDirectory, IEnvironment environment) 417internal 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\InternalMicrosoftDetector.cs (3)
48private readonly IEnvironment _environment; 57public InternalMicrosoftDetector(CliExecutionContext executionContext, IEnvironment environment, TimeProvider timeProvider, ILogger<InternalMicrosoftDetector> logger, IProcessExecutionFactory processExecutionFactory) 71IEnvironment environment,
Telemetry\TelemetryServiceCollectionExtensions.cs (2)
22var environment = sp.GetRequiredService<IEnvironment>();
Templating\CliTemplateFactory.cs (2)
72private readonly IEnvironment _environment; 84IEnvironment 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)
174internal 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)
18private readonly IEnvironment _environment; 26IEnvironment environment, 36IEnvironment 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)
34public static string GetMessage(DirectoryInfo directory, LanguageInfo? language, IEnvironment environment) 40private static (string InstallCommand, string InstallDisplayName) GetMessageParts(DirectoryInfo directory, LanguageInfo? language, IEnvironment environment)
Aspire.Cli.Tests (44)
BundleServiceIntegrationTests.cs (1)
477/// 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)
98var environment = CreateEnvironment(new Dictionary<string, string?> 112var environment = CreateEnvironment(new Dictionary<string, string?>()); 123var environment = CreateEnvironment(new Dictionary<string, string?>()); 470var environment = CreateEnvironment(new Dictionary<string, string?>()); 483var environment = CreateEnvironment(new Dictionary<string, string?> 500var environment = CreateEnvironment(new Dictionary<string, string?>()); 514var environment = CreateEnvironment(new Dictionary<string, string?> 532var environment = CreateEnvironment(new Dictionary<string, string?> 548var environment = CreateEnvironment(new Dictionary<string, string?>()); 635private 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)
4265IEnvironment? environment = null) 4283services.RemoveAll<IEnvironment>();
Projects\GuestAppHostProjectTests.cs (1)
1458IEnvironment? environment = null,
Projects\ProjectLocatorTests.cs (1)
4168IEnvironment? environment = null,
Utils\CliTestHelper.cs (10)
224services.AddSingleton<IEnvironment, TestEnvironment>(); 474var environment = serviceProvider.GetRequiredService<IEnvironment>(); 535var environment = serviceProvider.GetRequiredService<IEnvironment>(); 549return new ScaffoldingService(appHostServerProjectFactory, serverSessionFactory, languageDiscovery, interactionService, serviceProvider.GetRequiredService<IEnvironment>(), logger, executionContext, serviceProvider.GetRequiredService<ProfilingTelemetry>()); 589var environment = serviceProvider.GetRequiredService<IEnvironment>(); 637var cliFactory = new CliTemplateFactory(languageDiscovery, projectFactory, scaffoldingService, prompter, executionContext, interactionService, hostEnvironment, serviceProvider.GetRequiredService<IEnvironment>(), templateNuGetConfigService, cliTemplateLogger); 676return 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