mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +08:00
Show documentation version in footer
This commit is contained in:
parent
52e3ee17b0
commit
0cecb555d5
@ -1,10 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
||||
<DefaultItemExcludes>$(DefaultItemExcludes);output\**;.gitignore</DefaultItemExcludes>
|
||||
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -23,7 +24,14 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.5" />
|
||||
<PackageReference Include="NJsonSchema" Version="10.1.12" />
|
||||
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Versioning" BeforeTargets="MinVer">
|
||||
<PropertyGroup Label="Build">
|
||||
<MinVerDefaultPreReleasePhase>preview</MinVerDefaultPreReleasePhase>
|
||||
<MinVerVerbosity>normal</MinVerVerbosity>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
</Project>
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
@ -183,7 +183,10 @@
|
||||
</div>
|
||||
<div id="footer" class="p-3 text-white font-size-sm">
|
||||
<div class="container">
|
||||
<div>© @DateTime.Today.Year Spectre Systems AB</div>
|
||||
<div>
|
||||
<span>© @DateTime.Today.Year Spectre Systems AB</span>
|
||||
<span class="float-right" style="color: #888888;">@VersionUtilities.GetVersion()</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -3,5 +3,6 @@
|
||||
@using Statiq.Web
|
||||
@using Statiq.Web.Pipelines
|
||||
@using Docs
|
||||
@using Docs.Utilities;
|
||||
|
||||
@inherits StatiqRazorPage<IDocument>
|
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Docs.Models;
|
||||
using NJsonSchema;
|
||||
using Statiq.Common;
|
||||
using Statiq.Core;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NJsonSchema;
|
||||
using Statiq.Common;
|
||||
using System.Xml.Linq;
|
||||
using Docs.Pipelines;
|
||||
|
34
docs/src/Utilities/VersionUtilities.cs
Normal file
34
docs/src/Utilities/VersionUtilities.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace Docs.Utilities
|
||||
{
|
||||
public static class VersionUtilities
|
||||
{
|
||||
public static string GetVersion()
|
||||
{
|
||||
return GetVersion(typeof(VersionUtilities).Assembly);
|
||||
}
|
||||
|
||||
private static string GetVersion(Assembly assembly)
|
||||
{
|
||||
if (assembly == null)
|
||||
{
|
||||
return "?";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var info = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
return info.ProductVersion ?? "?";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user