mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-24 06:23:01 +08:00
MQTTnet.Server: Fix version detection.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace MQTTnet.Server.Controllers
|
namespace MQTTnet.Server.Controllers
|
||||||
@@ -12,7 +13,8 @@ namespace MQTTnet.Server.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public ActionResult<string> GetVersion()
|
public ActionResult<string> GetVersion()
|
||||||
{
|
{
|
||||||
return Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
var fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
||||||
|
return fileVersion.ProductVersion.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<StartupObject></StartupObject>
|
<StartupObject>MQTTnet.Server.Program</StartupObject>
|
||||||
<UserSecretsId>c564f0de-28b4-45bf-b726-4d665d705653</UserSecretsId>
|
<UserSecretsId>c564f0de-28b4-45bf-b726-4d665d705653</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using MQTTnet.Server.Web;
|
using MQTTnet.Server.Web;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace MQTTnet.Server
|
namespace MQTTnet.Server
|
||||||
@@ -58,8 +59,11 @@ namespace MQTTnet.Server
|
|||||||
Console.WriteLine(@"https://github.com/chkr1011/MQTTnet");
|
Console.WriteLine(@"https://github.com/chkr1011/MQTTnet");
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.White;
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
|
|
||||||
|
var fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
|
||||||
|
|
||||||
Console.WriteLine($@"
|
Console.WriteLine($@"
|
||||||
Version: {Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion}
|
Version: {fileVersion.ProductVersion}
|
||||||
License: MIT (read LICENSE file)
|
License: MIT (read LICENSE file)
|
||||||
Sponsoring: https://opencollective.com/mqttnet
|
Sponsoring: https://opencollective.com/mqttnet
|
||||||
Support: https://github.com/chkr1011/MQTTnet/issues
|
Support: https://github.com/chkr1011/MQTTnet/issues
|
||||||
|
|||||||
Reference in New Issue
Block a user