Adding "BuildRid" to the CLI as a fallback RID to use when inferring which RID to use when building, running, and publishing self-contained applications.
This enables users to use the CLI on newer versions of the OS that aren't fully supported yet - for example using a new OSX version that isn't listed in the runtime graph in the current NuGet packages. Fix #4238
This commit is contained in:
parent
74df06500c
commit
ce6c29676d
19 changed files with 149 additions and 54 deletions
|
@ -209,7 +209,8 @@ namespace Microsoft.DotNet.Cli
|
|||
{
|
||||
HelpCommand.PrintVersionHeader();
|
||||
|
||||
var commitSha = GetCommitSha() ?? "N/A";
|
||||
DotnetVersionFile versionFile = DotnetFiles.VersionFileObject;
|
||||
var commitSha = versionFile.CommitSha ?? "N/A";
|
||||
Reporter.Output.WriteLine();
|
||||
Reporter.Output.WriteLine("Product Information:");
|
||||
Reporter.Output.WriteLine($" Version: {Product.Version}");
|
||||
|
@ -219,7 +220,9 @@ namespace Microsoft.DotNet.Cli
|
|||
Reporter.Output.WriteLine($" OS Name: {RuntimeEnvironment.OperatingSystem}");
|
||||
Reporter.Output.WriteLine($" OS Version: {RuntimeEnvironment.OperatingSystemVersion}");
|
||||
Reporter.Output.WriteLine($" OS Platform: {RuntimeEnvironment.OperatingSystemPlatform}");
|
||||
Reporter.Output.WriteLine($" RID: {RuntimeEnvironment.GetRuntimeIdentifier()}");
|
||||
|
||||
// report the BuildRid instead of the current RID, so the user knows which RID they should put in their "runtimes" section.
|
||||
Reporter.Output.WriteLine($" RID: {versionFile.BuildRid ?? RuntimeEnvironment.GetRuntimeIdentifier()}");
|
||||
}
|
||||
|
||||
private static bool IsArg(string candidate, string longName)
|
||||
|
@ -231,17 +234,5 @@ namespace Microsoft.DotNet.Cli
|
|||
{
|
||||
return (shortName != null && candidate.Equals("-" + shortName)) || (longName != null && candidate.Equals("--" + longName));
|
||||
}
|
||||
|
||||
private static string GetCommitSha()
|
||||
{
|
||||
var versionFile = DotnetFiles.VersionFile;
|
||||
|
||||
if (File.Exists(versionFile))
|
||||
{
|
||||
return File.ReadLines(versionFile).FirstOrDefault()?.Substring(0, 10);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue