private void ReadSettings(PackageRestoreInputs packageRestoreInputs) { if (IsSolutionRestore(packageRestoreInputs)) { var solutionDirectory = GetSolutionDirectory(packageRestoreInputs); // Read the solution-level settings var solutionSettingsFile = Path.Combine( solutionDirectory, NuGetConstants.NuGetSolutionSettingsFolder); if (ConfigFile != null) { ConfigFile = Path.GetFullPath(ConfigFile); } Settings = Configuration.Settings.LoadDefaultSettings( solutionSettingsFile, configFileName: ConfigFile, machineWideSettings: MachineWideSettings); // Recreate the source provider and credential provider SourceProvider = PackageSourceBuilder.CreateSourceProvider(Settings); SetDefaultCredentialProvider(); } }
private void CalculateEffectiveSettings() { // If the SolutionDir is specified, use the .nuget directory under it to determine the solution-level settings if (!string.IsNullOrEmpty(SolutionDirectory)) { string path; try { path = Path.Combine(SolutionDirectory, NuGetConstants.NuGetSolutionSettingsFolder); } catch (ArgumentException e) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, LocalizedResourceManager.GetString("Error_InvalidSolutionDirectory"), SolutionDirectory), e); } var solutionSettingsFile = Path.GetFullPath(path); Settings = Configuration.Settings.LoadDefaultSettings( solutionSettingsFile, configFileName: null, machineWideSettings: MachineWideSettings); // Recreate the source provider and credential provider SourceProvider = PackageSourceBuilder.CreateSourceProvider(Settings); SetDefaultCredentialProvider(); } }
public void Execute() { if (Help) { HelpCommand.ViewHelpForCommand(CommandAttribute.CommandName); } else { if (string.IsNullOrEmpty(ConfigFile)) { string configFileName = null; var packCommand = this as PackCommand; if (packCommand != null && !string.IsNullOrEmpty(packCommand.ConfigFile)) { configFileName = packCommand.ConfigFile; } Settings = Configuration.Settings.LoadDefaultSettings( CurrentDirectory, configFileName: configFileName, machineWideSettings: MachineWideSettings); } else { var configFileFullPath = Path.GetFullPath(ConfigFile); var directory = Path.GetDirectoryName(configFileFullPath); var configFileName = Path.GetFileName(configFileFullPath); Settings = Configuration.Settings.LoadDefaultSettings( directory, configFileName, MachineWideSettings); } SourceProvider = PackageSourceBuilder.CreateSourceProvider(Settings); SetDefaultCredentialProvider(); RepositoryFactory = new CommandLineRepositoryFactory(Console); UserAgent.SetUserAgentString(new UserAgentStringBuilder(CommandLineConstants.UserAgent)); OutputNuGetVersion(); ExecuteCommandAsync().GetAwaiter().GetResult(); } }
private void CalculateEffectiveSettings() { // If the SolutionDir is specified, use the .nuget directory under it to determine the solution-level settings if (!String.IsNullOrEmpty(SolutionDirectory)) { var path = Path.Combine(SolutionDirectory.TrimEnd(Path.DirectorySeparatorChar), NuGetConstants.NuGetSolutionSettingsFolder); var solutionSettingsFile = Path.GetFullPath(path); Settings = Configuration.Settings.LoadDefaultSettings( solutionSettingsFile, configFileName: null, machineWideSettings: MachineWideSettings); // Recreate the source provider and credential provider SourceProvider = PackageSourceBuilder.CreateSourceProvider(Settings); SetDefaultCredentialProvider(); } }