2016-03-03 22:57:43 -08:00
|
|
|
|
// 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.
|
|
|
|
|
|
2016-04-18 15:51:35 -07:00
|
|
|
|
using System;
|
2016-03-03 22:57:43 -08:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
2016-04-18 15:51:35 -07:00
|
|
|
|
using Microsoft.Extensions.PlatformAbstractions;
|
2016-03-03 22:57:43 -08:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Utils
|
|
|
|
|
{
|
|
|
|
|
public static class DotnetFiles
|
|
|
|
|
{
|
|
|
|
|
/// <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(typeof(DotnetFiles).GetTypeInfo().Assembly.Location, "..", ".version"));
|
2016-04-18 15:51:35 -07:00
|
|
|
|
|
|
|
|
|
/// <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 += PlatformServices.Default.Runtime.GetRuntimeIdentifier();
|
|
|
|
|
return content;
|
|
|
|
|
}
|
2016-03-03 22:57:43 -08:00
|
|
|
|
}
|
|
|
|
|
}
|