1 implementation of Host
Microsoft.TemplateEngine.Edge (1)
EngineEnvironmentSettings.cs (1)
61
public ITemplateEngineHost
Host
{ get; }
164 references to Host
dotnet (15)
Commands\New\MSBuildEvaluation\MSBuildEvaluator.cs (2)
56
_logger = _settings.
Host
.LoggerFactory.CreateLogger(nameof(MSBuildEvaluator));
86
foundFiles = FileFindHelpers.FindFilesAtOrAbovePath(engineEnvironmentSettings.
Host
.FileSystem, _outputDirectory, "*.*proj");
Commands\New\MSBuildEvaluation\ProjectCapabilityConstraint.cs (3)
27
environmentSettings.
Host
.Logger.LogDebug("{0}: '{1}' component is not available.", nameof(ProjectCapabilityConstraintFactory), nameof(MSBuildEvaluator));
38
environmentSettings.
Host
.Logger.LogDebug("{0}: Failed to evaluate the project: {1}.", nameof(ProjectCapabilityConstraintFactory), e.Message);
55
_logger = _environmentSettings.
Host
.LoggerFactory.CreateLogger(nameof(MSBuildEvaluator));
Commands\New\MSBuildEvaluation\ProjectContextSymbolSource.cs (6)
34
settings.
Host
.Logger.LogDebug("{0}: {1} component is not available, exiting.", nameof(ProjectContextSymbolSource), nameof(MSBuildEvaluator));
41
settings.
Host
.Logger.LogDebug("{0}: evaluation did not succeed, status: {1}, exiting.", nameof(ProjectContextSymbolSource), evaluationResult.Status);
46
settings.
Host
.Logger.LogDebug("The project {0} is not an SDK style project, and is not supported for evaluation.", evaluationResult.ProjectPath);
59
settings.
Host
.Logger.LogDebug("{0}: value for {1}: {2}.", nameof(ProjectContextSymbolSource), bindname, propertyValue);
64
settings.
Host
.Logger.LogDebug("{0}: value for {1}: {2}.", nameof(ProjectContextSymbolSource), bindname, propertyValue ?? "<null>");
69
settings.
Host
.Logger.LogDebug("{0}: unexpected error during evaluation: {1}.", nameof(ProjectContextSymbolSource), e.Message);
Commands\New\OptionalWorkloadProvider.cs (1)
41
var fileSystem = _environmentSettings.
Host
.FileSystem;
Commands\New\PostActions\DotnetAddPostActionProcessor.cs (2)
70
projectsToProcess = FindExistingTargetFiles(environment.
Host
.FileSystem, action.Args, outputBasePath);
97
return FindProjFileAtOrAbovePath(environment.
Host
.FileSystem, outputBasePath, extensionLimiters);
Commands\New\PostActions\DotnetSlnPostActionProcessor.cs (1)
70
IReadOnlyList<string> nearestSlnFilesFound = FindSolutionFilesAtOrAbovePath(environment.
Host
.FileSystem, outputBasePath);
Microsoft.TemplateEngine.Cli (24)
Alias\AliasRegistry.cs (4)
134
if (!_environmentSettings.
Host
.FileSystem.FileExists(_aliasesFilePath))
139
JsonObject parsed = _environmentSettings.
Host
.FileSystem.ReadObject(_aliasesFilePath);
161
_environmentSettings.
Host
.FileSystem.WriteObject(_aliasesFilePath, root);
165
_environmentSettings.
Host
.FileSystem.FileDelete(_aliasesFilePath);
Commands\BaseCommand.cs (3)
187
environmentSettings.
Host
.FileSystem.DirectoryDelete(environmentSettings.Paths.HostVersionSettingsDir, true);
188
environmentSettings.
Host
.FileSystem.CreateDirectory(environmentSettings.Paths.HostVersionSettingsDir);
249
using (Timing.Over(environmentSettings.
Host
.Logger, "Execute"))
Commands\create\InstantiateCommand.cs (4)
142
environmentSettings.
Host
.Logger.LogWarning(LocalizableStrings.InstantiateCommand_Warning_FailedToGetTemplatePackageForTemplateGroup, templateGroup.GroupIdentity);
143
environmentSettings.
Host
.Logger.LogDebug("Details: {exception}.", ex);
335
environmentSettings.
Host
.Logger.LogWarning(LocalizableStrings.InstantiateCommand_Warning_FailedToGetTemplatePackageForTemplate, template.Identity);
336
environmentSettings.
Host
.Logger.LogDebug("Details: {exception}.", ex);
Extensions.cs (1)
17
if (!settings.
Host
.TryGetHostParamDefault("prefs:language", out string? defaultLanguage))
HostSpecificDataLoader.cs (2)
54
_engineEnvironment.
Host
.Logger.LogWarning(
81
_engineEnvironment.
Host
.Logger.LogWarning(
NuGetUtils.cs (2)
19
if (!engineEnvironmentSettings.
Host
.FileSystem.FileExists(packageLocation))
27
using Stream inputStream = engineEnvironmentSettings.
Host
.FileSystem.OpenRead(packageLocation);
PostActionProcessors\AddJsonPropertyPostActionProcessor.cs (5)
104
string? repoRoot = detectRepoRoot ? GetRootDirectory(environment.
Host
.FileSystem, outputBasePath) : null;
113
environment.
Host
.FileSystem,
135
environment.
Host
.FileSystem.WriteAllText(newJsonFilePath, "{}");
153
environment.
Host
.FileSystem,
166
environment.
Host
.FileSystem.WriteAllText(jsonFiles[0], newJsonContent.ToJsonString(SerializerOptions));
PostActionProcessors\ProcessStartPostActionProcessor.cs (1)
51
string resolvedExecutablePath = ResolveExecutableFilePath(environment.
Host
.FileSystem, executable, outputBasePath);
TemplateInvoker.cs (2)
33
_cliTemplateEngineHost = _environmentSettings.
Host
as ICliTemplateEngineHost ?? throw new ArgumentException($"The hosts other than {nameof(ICliTemplateEngineHost)} are not supported.");
124
return _environmentSettings.
Host
.FileSystem
Microsoft.TemplateEngine.Edge (99)
BuiltInManagedProvider\GlobalSettings.cs (6)
30
environmentSettings.
Host
.FileSystem.CreateDirectory(Path.GetDirectoryName(_globalSettingsFile));
72
if (!_environmentSettings.
Host
.FileSystem.FileExists(_globalSettingsFile))
83
var jObject = _environmentSettings.
Host
.FileSystem.ReadObject(_globalSettingsFile);
136
_environmentSettings.
Host
.FileSystem.WriteObject(_globalSettingsFile, globalSettingsData, GlobalSettingsJsonSerializerContext.Default.GlobalSettingsData);
158
return _environmentSettings.
Host
.FileSystem.WatchFileChanges(_globalSettingsFile, FileChanged);
217
_environmentSettings.
Host
.Logger.LogDebug(
BuiltInManagedProvider\GlobalSettingsTemplatePackageProvider.cs (3)
25
_logger = settings.
Host
.LoggerFactory.CreateLogger<GlobalSettingsTemplatePackageProvider>();
28
if (!settings.
Host
.FileSystem.DirectoryExists(packagesFolder))
30
settings.
Host
.FileSystem.CreateDirectory(packagesFolder);
Components\EnvironmentVariablesBindSource.cs (2)
27
settings.
Host
.Logger.LogDebug(
34
settings.
Host
.Logger.LogDebug(
Components\HostParametersBindSource.cs (3)
27
settings.
Host
.Logger.LogDebug(
32
settings.
Host
.TryGetHostParamDefault(bindName, out string? newValue);
34
settings.
Host
.Logger.LogDebug(
Constraints\HostConstraint.cs (6)
37
foreach (HostInformation hostInfo in supportedHosts.Where(h => h.HostName.Equals(EnvironmentSettings.
Host
.HostIdentifier, StringComparison.OrdinalIgnoreCase)))
40
if (hostInfo.Version == null || hostInfo.Version.CheckIfVersionIsValid(EnvironmentSettings.
Host
.Version))
48
foreach (HostInformation hostInfo in supportedHosts.Where(h => EnvironmentSettings.
Host
.FallbackHostTemplateConfigNames.Contains(h.HostName, StringComparer.OrdinalIgnoreCase)))
50
if (hostInfo.Version == null || hostInfo.Version.CheckIfVersionIsValid(EnvironmentSettings.
Host
.Version))
56
string errorMessage = string.Format(LocalizableStrings.HostConstraint_Message_Restricted, EnvironmentSettings.
Host
.HostIdentifier, EnvironmentSettings.
Host
.Version, supportedHosts.ToCsvString());
Constraints\WorkloadConstraintFactory.cs (1)
52
environmentSettings.
Host
.Logger,
DefaultPathInfo.cs (2)
69
HostSettingsDir = GetDefaultHostSettingsDir(engineEnvironmentSettings.
Host
, globalDir: GlobalSettingsDir);
70
HostVersionSettingsDir = GetDefaultHostVersionSettingsDir(engineEnvironmentSettings.
Host
, globalDir: GlobalSettingsDir);
Installers\Folder\FolderInstaller.cs (2)
26
return Task.FromResult(_settings.
Host
.FileSystem.DirectoryExists(installationRequest.PackageIdentifier));
52
if (_settings.
Host
.FileSystem.DirectoryExists(installRequest.PackageIdentifier))
Installers\Folder\FolderManagedTemplatePackage.cs (2)
29
_logger = settings.
Host
.LoggerFactory.CreateLogger<FolderManagedTemplatePackage>();
45
DateTime physicalWriteTimeUtc = _settings.
Host
.FileSystem.GetLastWriteTimeUtc(MountPointUri);
Installers\NuGet\NugetApiPackageManager.cs (5)
31
_nugetLogger = new NuGetLogger(_environmentSettings.
Host
.LoggerFactory);
109
if (!force && _environmentSettings.
Host
.FileSystem.FileExists(filePath))
116
using Stream packageStream = _environmentSettings.
Host
.FileSystem.CreateFile(filePath);
144
_environmentSettings.
Host
.FileSystem.FileDelete(filePath);
167
_environmentSettings.
Host
.FileSystem.FileDelete(filePath);
Installers\NuGet\NuGetInstaller.cs (11)
25
_logger = settings.
Host
.LoggerFactory.CreateLogger<NuGetInstaller>();
31
if (!_environmentSettings.
Host
.FileSystem.DirectoryExists(installPath))
33
_environmentSettings.
Host
.FileSystem.CreateDirectory(installPath);
46
_logger = settings.
Host
.LoggerFactory.CreateLogger<NuGetInstaller>();
54
if (!_environmentSettings.
Host
.FileSystem.DirectoryExists(installPath))
56
_environmentSettings.
Host
.FileSystem.CreateDirectory(installPath);
346
_environmentSettings.
Host
.FileSystem.FileDelete(templatePackage.MountPointUri);
391
return _environmentSettings.
Host
.FileSystem.FileExists(installRequest.PackageIdentifier);
410
if (!installRequest.Force && _environmentSettings.
Host
.FileSystem.FileExists(targetPackageLocation))
418
_environmentSettings.
Host
.FileSystem.FileCopy(installRequest.PackageIdentifier, targetPackageLocation, overwrite: installRequest.Force);
432
using Stream inputStream = _environmentSettings.
Host
.FileSystem.OpenRead(packageLocation);
Installers\NuGet\NuGetManagedTemplatePackage.cs (3)
44
_logger = settings.
Host
.LoggerFactory.CreateLogger<NuGetInstaller>();
82
_logger = settings.
Host
.LoggerFactory.CreateLogger<NuGetInstaller>();
103
return _settings.
Host
.FileSystem.GetLastWriteTimeUtc(MountPointUri);
Mount\Archive\ZipFileMountPointFactory.cs (2)
35
if (!environmentSettings.
Host
.FileSystem.FileExists(uri.LocalPath))
43
archive = new ZipArchive(environmentSettings.
Host
.FileSystem.OpenRead(uri.LocalPath), ZipArchiveMode.Read, false);
Mount\FileSystem\FileSystemDirectory.cs (1)
21
_fileSystem = mountPoint.EnvironmentSettings.
Host
.FileSystem;
Mount\FileSystem\FileSystemFile.cs (2)
18
public override bool Exists => MountPoint.EnvironmentSettings.
Host
.FileSystem.FileExists(_physicalPath);
22
return MountPoint.EnvironmentSettings.
Host
.FileSystem.OpenRead(_physicalPath);
Mount\FileSystem\FileSystemMountPoint.cs (1)
63
if (EnvironmentSettings.
Host
.FileSystem.DirectoryExists(fullPath))
Mount\FileSystem\FileSystemMountPointFactory.cs (1)
29
if (parent != null || !environmentSettings.
Host
.FileSystem.DirectoryExists(uri.LocalPath))
Settings\ComponentManager.cs (2)
59
foreach (var (interfaceType, instance) in engineEnvironmentSettings.
Host
.BuiltInComponents)
261
_engineEnvironmentSettings.
Host
.FileSystem.WriteObject(_paths.SettingsFile, _settings, SettingsStoreJsonSerializerContext.Default.SettingsStore);
Settings\Scanner.cs (4)
30
_logger = environmentSettings.
Host
.LoggerFactory.CreateLogger<Scanner>();
192
_environmentSettings.
Host
.FileSystem.DirectoryDelete(actualScanPath, true);
213
_environmentSettings.
Host
.FileSystem.CreateDirectory(targetBasePath); // creates Packages/ or Content/ if needed
286
using Stream fileStream = _environmentSettings.
Host
.FileSystem.OpenRead(file);
Settings\SettingsFilePaths.cs (19)
39
if (_environmentSettings.
Host
.FileSystem.FileExists(path))
41
_environmentSettings.
Host
.FileSystem.FileCopy(path, targetPath, true);
49
if (_environmentSettings.
Host
.FileSystem.DirectoryExists(p))
64
_environmentSettings.
Host
.FileSystem.FileCopy(p, wholeTargetPath, true);
71
if (_environmentSettings.
Host
.FileSystem.DirectoryExists(path))
73
_environmentSettings.
Host
.FileSystem.DirectoryDelete(path, true);
75
if (_environmentSettings.
Host
.FileSystem.FileExists(path))
77
_environmentSettings.
Host
.FileSystem.FileDelete(path);
83
if (_environmentSettings.
Host
.FileSystem.DirectoryExists(path))
85
return _environmentSettings.
Host
.FileSystem.EnumerateDirectories(path, pattern, searchOption);
93
if (_environmentSettings.
Host
.FileSystem.FileExists(path))
98
if (_environmentSettings.
Host
.FileSystem.DirectoryExists(path))
100
return _environmentSettings.
Host
.FileSystem.EnumerateFiles(ProcessPath(path), pattern, searchOption);
108
if (_environmentSettings.
Host
.FileSystem.FileExists(path))
113
if (_environmentSettings.
Host
.FileSystem.DirectoryExists(path))
115
return _environmentSettings.
Host
.FileSystem.EnumerateFileSystemEntries(ProcessPath(path), pattern, searchOption);
123
return _environmentSettings.
Host
.FileSystem.FileExists(path) || _environmentSettings.
Host
.FileSystem.DirectoryExists(path);
140
_environmentSettings.
Host
.FileSystem.CreateDirectory(current);
Settings\SettingsStore.cs (4)
93
using (Timing.Over(engineEnvironmentSettings.
Host
.Logger, "Parse settings"))
97
parsed = engineEnvironmentSettings.
Host
.FileSystem.ReadObject(paths.SettingsFile);
105
using (Timing.Over(engineEnvironmentSettings.
Host
.Logger, "Deserialize user settings"))
110
using (Timing.Over(engineEnvironmentSettings.
Host
.Logger, "Init probing paths"))
Settings\TemplateCache.cs (6)
23
ILogger logger = environmentSettings.
Host
.Logger;
203
if (newTemplate.HostConfigFiles.TryGetValue(settings.
Host
.HostIdentifier, out string? preferredHostFilePath))
208
foreach (string fallbackHostName in settings.
Host
.FallbackHostTemplateConfigNames)
224
settings.
Host
.Logger.LogDebug($"Start loading host config {template.MountPointUri}{path}");
236
settings.
Host
.Logger.LogWarning(
244
settings.
Host
.Logger.LogDebug($"End loading host config {template.MountPointUri}{path}");
Settings\TemplatePackageManager.cs (3)
34
_logger = environmentSettings.
Host
.LoggerFactory.CreateLogger<TemplatePackageManager>();
282
_userTemplateCache = cache = new TemplateCache(_environmentSettings.
Host
.FileSystem.ReadObject(_paths.TemplateCacheFile));
376
_environmentSettings.
Host
.FileSystem.WriteObject(_paths.TemplateCacheFile, cache, TemplateCacheJsonSerializerContext.Default.TemplateCache);
Template\ParameterSetBuilder.cs (1)
158
ITemplateEngineHost host = environment.
Host
;
Template\TemplateCreator.cs (6)
22
_logger = _environmentSettings.
Host
.LoggerFactory.CreateLogger<TemplateCreator>();
99
ValidationUtils.LogValidationResults(_environmentSettings.
Host
.Logger, new[] { template });
146
string targetDir = !string.IsNullOrWhiteSpace(outputPath) ? outputPath! : _environmentSettings.
Host
.FileSystem.GetCurrentDirectory();
153
_environmentSettings.
Host
.FileSystem.CreateDirectory(targetDir);
179
if (!_environmentSettings.
Host
.OnPotentiallyDestructiveChangesDetected(changes, destructiveChanges))
248
using (Timing.Over(_environmentSettings.
Host
.Logger, $"Template from config {info.MountPointUri}{info.ConfigPlace}"))
TemplateConstraintManager.cs (1)
21
_logger = engineEnvironmentSettings.
Host
.LoggerFactory.CreateLogger<TemplateConstraintManager>();
Microsoft.TemplateEngine.Utils (9)
DefaultTemplatePackageProvider.cs (2)
50
list.Add(new TemplatePackage(this, nupkg, _environmentSettings.
Host
.FileSystem.GetLastWriteTimeUtc(nupkg)));
54
list.Add(new TemplatePackage(this, folder, _environmentSettings.
Host
.FileSystem.GetLastWriteTimeUtc(folder)));
FileSystemInfoExtensions.cs (2)
12
source.MountPoint.EnvironmentSettings.
Host
.FileSystem.CreateDirectory(target);
16
using Stream f = source.MountPoint.EnvironmentSettings.
Host
.FileSystem.CreateFile(Path.Combine(target, file.Name));
IFileSystemInfoExtensions.cs (1)
23
if (fileSystemInfo.MountPoint.EnvironmentSettings.
Host
.FileSystem.DirectoryExists(fileSystemInfo.MountPoint.MountPointUri))
InstallRequestPathResolution.cs (3)
63
string searchTarget = Path.Combine(environmentSettings.
Host
.FileSystem.GetCurrentDirectory(), baseDir.Trim());
72
IEnumerable<string> matches = environmentSettings.
Host
.FileSystem.EnumerateFileSystemEntries(parentFolder, searchPattern, SearchOption.TopDirectoryOnly);
81
environmentSettings.
Host
.Logger.LogDebug("Failed to parse masked path {0}, {1}.", maskedPath, ex.ToString());
RuntimeValueUtils.cs (1)
22
if ((environmentSettings.
Host
.TryGetHostParamDefault(name, out string? newValue) && newValue != null)
Microsoft.TemplateSearch.Common (17)
Providers\NuGetMetadataSearchProvider.cs (13)
45
_logger = _environmentSettings.
Host
.LoggerFactory.CreateLogger<NuGetMetadataSearchProvider>();
73
_searchCache = TemplateSearchCache.FromJObject(_environmentSettings.
Host
.FileSystem.ReadObject(metadataLocation), _logger, _additionalDataReaders);
97
if (_environmentSettings.
Host
.FileSystem.FileExists(localOverridePath!))
112
if (_environmentSettings.
Host
.FileSystem.FileExists(preferredMetadataLocation))
138
if (_environmentSettings.
Host
.FileSystem.FileExists(metadataFileTargetLocation))
141
DateTime lastWriteTimeUtc = _environmentSettings.
Host
.FileSystem.GetLastWriteTimeUtc(metadataFileTargetLocation);
179
if (_environmentSettings.
Host
.FileSystem.FileExists(etagFileLocation))
181
string etagValue = _environmentSettings.
Host
.FileSystem.ReadAllText(etagFileLocation);
194
_environmentSettings.
Host
.FileSystem.WriteAllText(searchMetadataFileLocation, resultText);
200
_environmentSettings.
Host
.FileSystem.WriteAllText(etagFileLocation, etagValues.First());
209
_environmentSettings.
Host
.FileSystem.SetLastWriteTimeUtc(searchMetadataFileLocation, DateTime.UtcNow);
224
if (_environmentSettings.
Host
.FileSystem.FileExists(searchMetadataFileLocation))
227
_environmentSettings.
Host
.Logger.LogWarning(LocalizableStrings.BlobStoreSourceFileProvider_Warning_LocalCacheWillBeUsed);
TemplateDiscoveryMetadata\LegacySearchCacheReader.cs (3)
58
environmentSettings.
Host
.Logger.LogDebug($"Reading cache file {pathToConfig}");
59
string cacheText = environmentSettings.
Host
.FileSystem.ReadAllText(pathToConfig);
63
return TryReadDiscoveryMetadata(cacheObject, environmentSettings.
Host
.Logger, additionalDataReaders, out discoveryMetadata);
TemplateSearchCoordinator.cs (1)
70
_environmentSettings.
Host
.Logger.LogDebug("Search by provider {0} failed, details: {1}", provider.Factory.DisplayName, ex);