Fix update-dependencies by slimming it way down.

It can no longer be dependent on Cli.Utils, since that will affect which version of NuGet gets used.  It's better for this small console app to just depend on VersionTools.
This commit is contained in:
Eric Erhardt 2017-05-11 10:15:05 -05:00
parent 928c510c84
commit f82fa91f58
5 changed files with 22 additions and 20 deletions

View file

@ -28,7 +28,7 @@
<!-- infrastructure and test only dependencies -->
<PropertyGroup>
<VersionToolsVersion>1.0.27-prerelease-01402-01</VersionToolsVersion>
<VersionToolsVersion>1.0.27-prerelease-01611-04</VersionToolsVersion>
<DotnetDebToolVersion>2.0.0-preview1-001877</DotnetDebToolVersion>
</PropertyGroup>
</Project>

View file

@ -1,12 +1,12 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.VersionTools;
using Microsoft.DotNet.VersionTools.Automation;
using Microsoft.DotNet.VersionTools.Dependencies;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Scripts
public static void Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
HandleDebugSwitch(ref args);
bool onlyUpdate = args.Length > 0 && string.Equals("--Update", args[0], StringComparison.OrdinalIgnoreCase);
@ -96,5 +96,21 @@ namespace Microsoft.DotNet.Scripts
VersionGroupName = "version"
};
}
private static void HandleDebugSwitch(ref string[] args)
{
if (args.Length > 0 && string.Equals("--debug", args[0], StringComparison.OrdinalIgnoreCase))
{
args = args.Skip(1).ToArray();
WaitForDebugger();
}
}
private static void WaitForDebugger()
{
Console.WriteLine("Waiting for debugger to attach. Press ENTER to continue");
Console.WriteLine($"Process ID: {Process.GetCurrentProcess().Id}");
Console.ReadLine();
}
}
}

View file

@ -1,17 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<Import Project="..\..\build\DependencyVersions.props" />
<PropertyGroup>
<Description>Updates the repos dependencies</Description>
<OutputType>Exe</OutputType>
<TargetFramework>$(CliTargetFramework)</TargetFramework>
<DisableImplicitFrameworkReferences>false</DisableImplicitFrameworkReferences>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.VersionTools" Version="$(VersionToolsVersion)" />
</ItemGroup>

View file

@ -42,11 +42,6 @@ if($LASTEXITCODE -ne 0) { throw "Failed to install stage0" }
# Put the stage0 on the path
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
# Generate some props files that are imported by update-dependencies
Write-Host "Generating property files..."
dotnet msbuild $RepoRoot\build.proj /p:Architecture=$Architecture /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles
if($LASTEXITCODE -ne 0) { throw "Failed to generate intermidates" }
# Restore the app
Write-Host "Restoring $ProjectPath..."
dotnet restore "$ProjectPath"

View file

@ -42,11 +42,7 @@ fi
# Put the stage 0 on the path
export PATH=$DOTNET_INSTALL_DIR:$PATH
# Generate some props files that are imported by update-dependencies
echo "Generating property files..."
dotnet msbuild "$REPO_ROOT/build.proj" /p:Architecture=x64 /p:GeneratePropsFile=true /t:WriteDynamicPropsToStaticPropsFiles
echo "Resotring $PROJECT_PATH..."
echo "Restoring $PROJECT_PATH..."
dotnet restore "$PROJECT_PATH"
if [ $? -ne 0 ]; then