diff --git a/src/NuGet.Core/NuGet.Commands/RestoreCommand/Utility/MSBuildRestoreUtility.cs b/src/NuGet.Core/NuGet.Commands/RestoreCommand/Utility/MSBuildRestoreUtility.cs index bd6551b3e5a..b39de6fadfd 100644 --- a/src/NuGet.Core/NuGet.Commands/RestoreCommand/Utility/MSBuildRestoreUtility.cs +++ b/src/NuGet.Core/NuGet.Commands/RestoreCommand/Utility/MSBuildRestoreUtility.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; @@ -560,10 +559,8 @@ private static bool AddDownloadDependencyIfNotExist(PackageSpec spec, NuGetFrame return false; } - private static bool AddDependencyIfNotExist(PackageSpec spec, LibraryDependency dependency) { - foreach (var framework in spec.TargetFrameworks.Select(e => e.FrameworkName)) { AddDependencyIfNotExist(spec, framework, dependency); @@ -633,16 +630,15 @@ private static void AddPackageDownloads(PackageSpec spec, IEnumerable _isPersistDGSet = new Lazy(() => IsPersistDGSet()); - - /// - /// True if NUGET_PERSIST_DG is set to true. - /// - private static bool IsPersistDGSet() - { - var settingValue = Environment.GetEnvironmentVariable("NUGET_PERSIST_DG"); - - bool val; - if (!string.IsNullOrEmpty(settingValue) - && bool.TryParse(settingValue, out val)) - { - return val; - } - - return false; - } - /// /// Function used to display errors and warnings at the end of restore operation. /// The errors and warnings are read from the assets file based on restore result. @@ -908,7 +885,7 @@ private static bool IsPersistDGSet() /// Logger used to display warnings and errors. public static Task ReplayWarningsAndErrorsAsync(LockFile lockFile, ILogger logger) { - var logMessages = lockFile?.LogMessages?.Select(m => m.AsRestoreLogMessage()) ?? + var logMessages = lockFile?.LogMessages?.Select(m => m.AsRestoreLogMessage()) ?? Enumerable.Empty(); return logger.LogMessagesAsync(logMessages); diff --git a/test/NuGet.Core.Tests/NuGet.Protocol.Tests/LocalFolderUtilityTests.cs b/test/NuGet.Core.Tests/NuGet.Protocol.Tests/LocalFolderUtilityTests.cs index ea324a563f0..073f8f77905 100644 --- a/test/NuGet.Core.Tests/NuGet.Protocol.Tests/LocalFolderUtilityTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Protocol.Tests/LocalFolderUtilityTests.cs @@ -1029,7 +1029,6 @@ private static IEnumerable ValidVersions() yield return "1.0.0"; yield return "0.0.1"; yield return "1.0.0-BETA"; - yield return "1.0.0"; yield return "1.0"; yield return "1.0.0.0"; yield return "1.0.1"; @@ -1260,4 +1259,4 @@ public void LocalFolderUtility_IsPossiblePackageMatch(string fileName, string id Assert.Equal(expected, result); } } -} +} \ No newline at end of file