diff --git a/build_projects/update-dependencies/Program.cs b/build_projects/update-dependencies/Program.cs index 6374b610f..62dcd0ed5 100644 --- a/build_projects/update-dependencies/Program.cs +++ b/build_projects/update-dependencies/Program.cs @@ -64,13 +64,7 @@ namespace Microsoft.DotNet.Scripts private static IDependencyUpdater CreateProjectJsonUpdater() { - const string noUpdateFileName = ".noautoupdate"; - - IEnumerable projectJsonFiles = Enumerable.Union( - Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories), - Directory.GetFiles(Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), "project.json.template", SearchOption.AllDirectories)) - .Where(p => !File.Exists(Path.Combine(Path.GetDirectoryName(p), noUpdateFileName)) && - !Path.GetDirectoryName(p).EndsWith("CSharp_Web", StringComparison.Ordinal)); + IEnumerable projectJsonFiles = GetProjectJsonsToUpdate(); return new ProjectJsonUpdater(projectJsonFiles) { @@ -78,6 +72,17 @@ namespace Microsoft.DotNet.Scripts }; } + private static IEnumerable GetProjectJsonsToUpdate() + { + const string noUpdateFileName = ".noautoupdate"; + + return Enumerable.Union( + Directory.GetFiles(Dirs.RepoRoot, "project.json", SearchOption.AllDirectories), + Directory.GetFiles(Path.Combine(Dirs.RepoRoot, @"src\dotnet\commands\dotnet-new"), "project.json.template", SearchOption.AllDirectories)) + .Where(p => !File.Exists(Path.Combine(Path.GetDirectoryName(p), noUpdateFileName)) && + !Path.GetDirectoryName(p).EndsWith("CSharp_Web", StringComparison.Ordinal)); + } + private static IDependencyUpdater CreateRegexUpdater(string repoRelativePath, string dependencyPropertyName, string packageId) { return new FileRegexPackageUpdater() diff --git a/build_projects/update-dependencies/update-dependencies.ps1 b/build_projects/update-dependencies/update-dependencies.ps1 index 4ce5ea223..04b890b34 100644 --- a/build_projects/update-dependencies/update-dependencies.ps1 +++ b/build_projects/update-dependencies/update-dependencies.ps1 @@ -34,9 +34,9 @@ if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" } # Put the stage0 on the path $env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH" -# Restore the build_projects -Write-Host "Restoring Build projects..." -pushd "$RepoRoot\build_projects" +# Restore the app +Write-Host "Restoring update-dependencies..." +pushd "$AppPath" dotnet restore if($LASTEXITCODE -ne 0) { throw "Failed to restore" } popd