dotnet-installer/src/dotnet/DotnetFiles.cs
Eric Erhardt eec324a844 Move all CLI libraries to be single-TFM targeting netstandard1.3 where possible.
Microsoft.Extensions.Testing.Abstractions is the only one I couldn't move to netstandard1.3 that should be.  But this library should be removed with the new `dotnet test` strategy.
2016-10-10 15:57:08 -05:00

40 lines
1.4 KiB
C#

// 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.IO;
using System.Reflection;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.PlatformAbstractions;
namespace Microsoft.DotNet.Cli
{
internal static class DotnetFiles
{
private static string SdkRootFolder => Path.Combine(typeof(DotnetFiles).GetTypeInfo().Assembly.Location, "..");
private static Lazy<DotnetVersionFile> s_versionFileObject =
new Lazy<DotnetVersionFile>(() => new DotnetVersionFile(VersionFile));
/// <summary>
/// The CLI ships with a .version file that stores the commit information and CLI version
/// </summary>
public static string VersionFile => Path.GetFullPath(Path.Combine(SdkRootFolder, ".version"));
internal static DotnetVersionFile VersionFileObject
{
get { return s_versionFileObject.Value; }
}
/// <summary>
/// Reads the version file and adds runtime specific information
/// </summary>
public static string ReadAndInterpretVersionFile()
{
var content = File.ReadAllText(DotnetFiles.VersionFile);
content += Environment.NewLine;
content += RuntimeEnvironment.GetRuntimeIdentifier();
return content;
}
}
}