MQTTnet.Server: Fix version detection.

This commit is contained in:
Christian Kratky
2020-04-16 12:48:26 +02:00
parent 4b08bb41f5
commit 2d6c44e45b
3 changed files with 9 additions and 3 deletions
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using System.Reflection;
namespace MQTTnet.Server.Controllers
@@ -12,7 +13,8 @@ namespace MQTTnet.Server.Controllers
[HttpGet]
public ActionResult<string> GetVersion()
{
return Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
var fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
return fileVersion.ProductVersion.ToString();
}
}
}