public SlnxHandler(string fName, SlnXType userSettings, IFileWriter writer, ILogger logger, string debugPackageId, bool offlineMode) { _logger = logger; _fileWriter = writer; _offlineMode = offlineMode; if (!string.IsNullOrEmpty(debugPackageId)) { userSettings = null; //Ignore use settings in case of an import via <debug package.../> } _slnxPath = Path.GetFullPath(fName); Assert(File.Exists(_slnxPath), "The provided SlnX file '{0}' is not a file or it doesn't exists", _slnxPath); _slnxDirectory = Path.GetDirectoryName(_slnxPath); _slnxFile = Path.GetFileName(fName); _slnxName = Path.GetFileNameWithoutExtension(fName); _specialSlnxKeys["slnx"] = _slnxDirectory; _slnx = ReadSlnx(fName); AppendSpecialKeys(false); ExtendDictionary(_environmentVariables, _slnx.env, true); ExtendDictionary(_packageBundles, _slnx.bundle, true); TryApplyUserEnvironmentValues(userSettings); //Eventually apply user settings SetAll(_environmentVariables); // to allow import having env variable in the path ExpandAll(_environmentVariables); // to allow import having env variable with special keys in the path ReadImports(_environmentVariables, _packageBundles, _packagesInfo); TryApplyUserEnvironmentValues(userSettings); //re-Apply, to override value from the imports ExpandAll(_environmentVariables); // to apply imports & user env vars string enforcedContainer = null; if (!string.IsNullOrEmpty(debugPackageId)) { enforcedContainer = $"_DEBUG/{debugPackageId}"; } if (offlineMode) { _offlineCache = new Uri(PackagesPath); _logger.Info($"Offline mode for {SlnxName}, using {PackagesPath} as package source."); } ExtendList(_packagesInfo, _slnx.package, _offlineCache); _projects = FindProjects(_slnx.project, ProjectsSearchPath, _slnx.skip, enforcedContainer); if (string.IsNullOrEmpty(debugPackageId)) //Main SlnX { EvalueteDebugPackages(_slnx.debug); EvalueteDebugPackages(userSettings?.debug); //Read debug SlnX foreach (var item in _packagesToDebug) { var debugSourcePakckage = PackagesInfo.Where(x => x.Identity.Id.Equals(item.Key, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); Assert(debugSourcePakckage != default(NuGetPackageInfo), $"The package {item.Key} is marked for debug, but it is not present as nuget package in the main SlnX file."); var slnxItem = new SlnxHandler(item.Value, _fileWriter, _logger, offlineMode, item.Key); _debugSlnxItems[debugSourcePakckage] = slnxItem; _packagesInfo.Remove(debugSourcePakckage); foreach (var candidate in slnxItem.Packages) { if (_packagesToDebug.ContainsKey(candidate.Identity.Id)) { //This package is under debug, no version check needed. continue; } var known = Packages.Where(x => x.Identity.Id.Equals(candidate.Identity.Id, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); if (known == default(NuGetPackage)) { _logger?.Warn($"The package {candidate} required by the SlnX {item.Key} selected for debug, is not present in the current SlnX file {_slnxName}{SlnxExtension}"); } else { Assert(known.Identity.MinVersion == candidate.Identity.MinVersion && known.TargetFramework == candidate.TargetFramework && known.PackageType == candidate.PackageType, $"The package {candidate} required by the SlnX {item.Key} selected for debug, does not match the already known one {known}"); } } } } }