public void Initalize(IConfiguration configuration) { _options = new MSBuildOptions(); ConfigurationBinder.Bind(configuration, _options); if (_environment.LogLevel < LogLevel.Information) { var buildEnvironmentInfo = MSBuildHelpers.GetBuildEnvironmentInfo(); _logger.LogDebug($"MSBuild environment: {Environment.NewLine}{buildEnvironmentInfo}"); } _packageDependencyChecker = new PackageDependencyChecker(_loggerFactory, _eventEmitter, _dotNetCli, _options); _loader = new ProjectLoader(_options, _environment.TargetDirectory, _propertyOverrides, _loggerFactory, _sdksPathResolver); _manager = new ProjectManager(_loggerFactory, _eventEmitter, _fileSystemWatcher, _metadataFileReferenceCache, _packageDependencyChecker, _loader, _workspace); var initialProjectPaths = GetInitialProjectPaths(); foreach (var projectFilePath in initialProjectPaths) { if (!File.Exists(projectFilePath)) { _logger.LogWarning($"Found project that doesn't exist on disk: {projectFilePath}"); continue; } _manager.QueueProjectUpdate(projectFilePath, allowAutoRestore: true); } }
public void Initalize(IConfiguration configuration) { if (Initialized) { return; } _options = new MSBuildOptions(); ConfigurationBinder.Bind(configuration, _options); _sdksPathResolver.Enabled = _options.UseLegacySdkResolver; _sdksPathResolver.OverridePath = _options.MSBuildSDKsPath; if (_environment.LogLevel < LogLevel.Information) { var buildEnvironmentInfo = MSBuildHelpers.GetBuildEnvironmentInfo(); _logger.LogDebug($"MSBuild environment: {Environment.NewLine}{buildEnvironmentInfo}"); } _packageDependencyChecker = new PackageDependencyChecker(_loggerFactory, _eventEmitter, _dotNetCli, _options); _loader = new ProjectLoader(_options, _environment.TargetDirectory, _propertyOverrides, _loggerFactory, _sdksPathResolver); var dotNetInfo = GetDotNetInfo(); _manager = new ProjectManager(_loggerFactory, _options, _eventEmitter, _fileSystemWatcher, _metadataFileReferenceCache, _packageDependencyChecker, _loader, _workspace, _assemblyLoader, _eventSinks, dotNetInfo); Initialized = true; if (_options.LoadProjectsOnDemand) { _logger.LogInformation($"Skip loading projects listed in solution file or under target directory because {Key}:{nameof(MSBuildOptions.LoadProjectsOnDemand)} is true."); return; } var initialProjectPathsAndIds = GetInitialProjectPathsAndIds(); foreach (var(projectFilePath, projectIdInfo) in initialProjectPathsAndIds) { if (!File.Exists(projectFilePath)) { _logger.LogWarning($"Found project that doesn't exist on disk: {projectFilePath}"); continue; } _manager.QueueProjectUpdate(projectFilePath, allowAutoRestore: true, projectIdInfo); } }
public void Initalize(IConfiguration configuration) { _options = new MSBuildOptions(); ConfigurationBinder.Bind(configuration, _options); if (!MSBuildEnvironment.IsInitialized) { MSBuildEnvironment.Initialize(_logger); if (MSBuildEnvironment.IsInitialized && _environment.LogLevel < LogLevel.Information) { var buildEnvironmentInfo = MSBuildHelpers.GetBuildEnvironmentInfo(); _logger.LogDebug($"MSBuild environment: {Environment.NewLine}{buildEnvironmentInfo}"); } } var initialProjectPaths = GetInitialProjectPaths(); foreach (var projectPath in initialProjectPaths) { if (!File.Exists(projectPath)) { _logger.LogWarning($"Found project that doesn't exist on disk: {projectPath}"); continue; } var project = LoadProject(projectPath); if (project == null) { // Diagnostics reported while loading the project have already been logged. continue; } _projectsToProcess.Enqueue(project); } ProcessProjects(); }