This commit is contained in:
RDeck 2025-11-11 04:24:46 -05:00
parent ac83188bc8
commit 4b105c81b8
2 changed files with 18 additions and 2 deletions

View File

@ -13,11 +13,20 @@ internal class ServiceMain : ServiceControl
{ {
ILog appLog = LogManager.GetLogger(Program.AppName); ILog appLog = LogManager.GetLogger(Program.AppName);
ConcurrentBag<Task> tasks = new(); ConcurrentBag<Task> tasks = new();
Version? AssemblyVersion = null;
public bool Start(HostControl hostControl) public bool Start(HostControl hostControl)
{ {
try
{
AssemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
}
catch
{
AssemblyVersion = new Version("1.0");
}
tasks.Add(Task.Run(() => { Looper(); })); tasks.Add(Task.Run(() => { Looper(); }));
appLog.Info(string.Format("Service successfully started.")); appLog.Info(string.Format("Service successfully started - v{0}", AssemblyVersion.ToString()));
return true; return true;
} //Start } //Start

View File

@ -1,10 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net9.0-windows</TargetFramework> <TargetFramework>net9.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AssemblyVersion>1.3.0.5</AssemblyVersion>
<FileVersion>1.3.0.5</FileVersion>
<Version>1.3.0.5</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -20,4 +23,8 @@
</None> </None>
</ItemGroup> </ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="if /I &quot;$(ConfigurationName)&quot; == &quot;Release&quot; c:\Misc\AutoVersionIncrement.exe &quot;$(ProjectDir)&quot;" />
</Target>
</Project> </Project>