<PublishSingleFile>True</PublishSingleFile>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
Host.CreateDefaultBuilder(args)
.UseWindowsService()
.ConfigureLogging(loggerFactory => loggerFactory.AddEventLog())
.ConfigureServices((hostContext, services) =>
{
services.AddHostedService<ServiceTelemetry>();
})
.ConfigureWebHostDefaults(webBuilder =>
{
var fileName = Process.GetCurrentProcess().MainModule.FileName;
var procDirectory = Directory.GetParent(fileName).FullName;
var appSettings = Path.Combine(procDirectory, "appsettings.json");
var config = new ConfigurationBuilder()
.SetBasePath(procDirectory)
.AddEnvironmentVariables()
.AddJsonFile(appSettings)
.AddCommandLine(args)
.Build();
webBuilder
.UseConfiguration(config)
.UseStartup<Startup>();
});