Apply code review feedback

This commit is contained in:
Daniel Plaisted 2017-04-26 14:57:18 -07:00
parent 06c1cc5990
commit cc9e942ede
10 changed files with 33 additions and 15 deletions

View file

@ -13,11 +13,19 @@ namespace ConsoleApplication
{
Console.WriteLine("Hello Portable World!");
var coreAssembly = typeof(object).GetTypeInfo().Assembly;
string coreFolder = Path.GetDirectoryName(coreAssembly.Location);
string frameworkVersion = Path.GetFileName(coreFolder);
var depsFile = new FileInfo(GetDataFromAppDomain("FX_DEPS_FILE"));
string frameworkVersion = depsFile.Directory.Name;
Console.WriteLine($"I'm running on shared framework version {frameworkVersion}!");
}
public static string GetDataFromAppDomain(string propertyName)
{
var appDomainType = typeof(object).GetTypeInfo().Assembly?.GetType("System.AppDomain");
var currentDomain = appDomainType?.GetProperty("CurrentDomain")?.GetValue(null);
var deps = appDomainType?.GetMethod("GetData")?.Invoke(currentDomain, new[] { propertyName });
return deps as string;
}
}
}

View file

@ -8,8 +8,6 @@ namespace Microsoft.DotNet.Cli.Utils
{
public interface IPackagedCommandSpecFactory
{
// Code review TODO: Is it OK to make breaking changes to the CLI Utils API surface?
CommandSpec CreateCommandSpecFromLibrary(
LockFileTargetLibrary toolLibrary,
string commandName,

View file

@ -41,7 +41,7 @@ namespace Microsoft.DotNet.Cli.Utils
else
{
arguments.Add("--fx-version");
arguments.Add(new Muxer().SharedFxVersion);
arguments.Add(muxer.SharedFxVersion);
}
}
}

View file

@ -1,4 +1,7 @@
using Microsoft.DotNet.Tools.Common;
// 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.Tools.Common;
using NuGet.Packaging;
using NuGet.ProjectModel;
using System;

View file

@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Cli.Utils
/// </summary>
internal class ForwardingAppImplementation
{
private const string s_hostExe = "dotnet";
private const string HostExe = "dotnet";
private readonly string _forwardApplicationPath;
private readonly IEnumerable<string> _argsToForward;
@ -102,7 +102,7 @@ namespace Microsoft.DotNet.Cli.Utils
private string GetHostExeName()
{
return $"{s_hostExe}{FileNameSuffixes.CurrentPlatform.Exe}";
return $"{HostExe}{FileNameSuffixes.CurrentPlatform.Exe}";
}
}
}

View file

@ -1,4 +1,7 @@
using System;
// 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 System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;

View file

@ -1,4 +1,7 @@
using Microsoft.DotNet.Cli.Utils;
// 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 System;
using System.Collections.Generic;
using System.Diagnostics;
@ -8,7 +11,7 @@ namespace Microsoft.DotNet.Cli
{
public class ForwardingApp
{
ForwardingAppImplementation _implementation;
private ForwardingAppImplementation _implementation;
public ForwardingApp(
string forwardApplicationPath,

View file

@ -20,7 +20,7 @@ namespace Microsoft.DotNet.Tools.MSBuild
private MSBuildForwardingAppWithoutLogging _forwardingAppWithoutLogging;
static IEnumerable<string> ConcatTelemetryLogger(IEnumerable<string> argsToForward)
private static IEnumerable<string> ConcatTelemetryLogger(IEnumerable<string> argsToForward)
{
if (Telemetry.CurrentSessionId != null)
{

View file

@ -462,7 +462,7 @@ namespace Microsoft.DotNet.Tests
{
// When using the product, the ToolDepsJsonGeneratorProject property is used to get this path, but for testing
// we'll hard code the path inside the SDK since we don't have a project to evaluate here
return Path.Combine(new RepoDirectoriesProvider().Stage2Sdk, @"Sdks\Microsoft.NET.Sdk\build\GenerateDeps\GenerateDeps.proj");
return Path.Combine(new RepoDirectoriesProvider().Stage2Sdk, "Sdks", "Microsoft.NET.Sdk", "build", "GenerateDeps", "GenerateDeps.proj");
}
}
}

View file

@ -1,4 +1,7 @@
using Microsoft.DotNet.Tools.Test.Utilities;
// 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.Tools.Test.Utilities;
using System;
using System.Collections.Generic;
using System.Text;