Skip to content

Commit

Permalink
support net8.0 and fix version resolution
Browse files Browse the repository at this point in the history
at some point the version started resolving with a build number. trimmed the build number
to keep parity.
  • Loading branch information
drewburlingame committed Nov 26, 2023
1 parent 6b4bb01 commit 5a79149
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ private static Task<int> AlertOnNewVersion(CommandContext context, ExecutionDele
private static bool TryGetCurrentVersion(out SemVersion semVersion)
{
return SemVersion.TryParse(AppInfo.Instance.Version, out semVersion);

}

private static bool TryGetLatestReleaseVersion(CommandContext context, NewerReleaseConfig config, out SemVersion? semVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ private static void AssertExitCodeAndErrorMessage(IScenario scenario, AppRunnerR
AssertUnexpectedOutputTexts(scenario, result, sb);
if (sb.Length > 0)
{
throw new AssertFailedException(sb.ToString());
var newLine = Environment.NewLine;
throw new AssertFailedException(
$"{sb}{newLine}Output:{newLine}{newLine}{result.Console.AllText()}");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;
using System.Reflection;
using System.Threading.Tasks;
using CommandDotNet.Builders;
using CommandDotNet.NewerReleasesAlerts;
Expand Down
7 changes: 5 additions & 2 deletions CommandDotNet/Builders/AppInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@ private static AppInfo BuildAppInfo()
return new AppInfo(isExe, isSelfContainedExe, isRunViaDotNetExe, entryAssembly, filePath!, fileName);
}

private static string? GetVersion(Assembly hostAssembly) =>
private static string? GetVersion(Assembly hostAssembly)
{
// thanks Spectre console for figuring this out https://github.com/spectreconsole/spectre.console/issues/242
hostAssembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "?";
var version = hostAssembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
return version?.Substring(0, version.IndexOf('+'));
}

public object Clone() => new AppInfo(IsExe, IsSelfContainedExe, IsRunViaDotNetExe, EntryAssembly, FilePath, FileName, _version);

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>11.0</LangVersion>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
Expand Down

0 comments on commit 5a79149

Please sign in to comment.