From c4b129a565473003d2dbd0b1158dfda70f2faea5 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Sun, 15 Jan 2023 00:15:43 +0000 Subject: [PATCH] Merged PR 68: .NET 6 upgrade - .NET 6 upgrade - .NET 6 upgrade - publish profile update --- Directory.Build.props | 2 +- ReleaseNotes.xml | 6 ++ dependencies.props | 28 +++---- ...etworkResurrector.Agent.Application.csproj | 4 +- .../Queries/GetSystemVersion.cs | 2 +- .../NetworkResurrector.Agent.Domain.csproj | 2 +- .../Commands/Cancel.cs | 2 +- .../Commands/Lock.cs | 2 +- .../Commands/Logout.cs | 2 +- .../Commands/Restart.cs | 2 +- .../Commands/Shutdown.cs | 2 +- .../Commands/Sleep.cs | 2 +- ...Resurrector.Agent.PublishedLanguage.csproj | 4 +- .../NetworkResurrector.Agent.Wrapper.csproj | 2 +- .../MSSqlServer/ColumnOptionsExtension.cs | 20 ----- .../StartupExtensions.cs} | 42 ++++------ .../NetworkResurrector.Agent.csproj | 6 +- src/agent/NetworkResurrector.Agent/Program.cs | 83 ++++++++----------- .../PublishProfiles/FolderProfile.pubxml | 8 +- .../appsettings.Development.json | 9 -- .../NetworkResurrector.Agent/appsettings.json | 3 + .../NetworkResurrector.Api.Application.csproj | 4 +- .../Queries/GetMachines.cs | 2 +- .../Queries/GetSystemVersion.cs | 2 +- .../NetworkResurrector.Api.Domain.Data.csproj | 2 +- .../NetworkResurrector.Api.Domain.csproj | 2 +- .../Commands/CancelAction.cs | 2 +- .../Commands/LockMachine.cs | 2 +- .../Commands/LogoutUser.cs | 2 +- .../Commands/PingMachine.cs | 2 +- .../Commands/RestartMachine.cs | 2 +- .../Commands/ShutdownMachine.cs | 2 +- .../Commands/SleepMachine.cs | 2 +- .../Commands/WakeMachine.cs | 2 +- ...rkResurrector.Api.PublishedLanguage.csproj | 4 +- .../Docker/amd64/Dockerfile | 4 +- .../StartupExtensions.cs} | 36 +++----- .../NetworkResurrector.Api.csproj | 8 +- .../Notes/Docker-amd64.txt | 40 --------- .../Notes/Docker-arm32v7.txt | 33 -------- src/api/NetworkResurrector.Api/Program.cs | 79 +++++++----------- .../Services/UserService.cs | 2 +- ...workResurrector.Server.Abstractions.csproj | 2 +- ...tworkResurrector.Server.Application.csproj | 2 +- .../NetworkResurrector.Server.Domain.csproj | 2 +- .../Commands/PingMachine.cs | 2 +- .../Commands/ShutdownMachine.cs | 2 +- .../Commands/WakeMachine.cs | 2 +- ...esurrector.Server.PublishedLanguage.csproj | 4 +- .../NetworkResurrector.Server.Wrapper.csproj | 2 +- .../NetworkResurrector.Server.csproj | 6 +- .../PublishProfiles/FolderProfile.pubxml | 8 +- .../NetworkResurrector.Server/Startup.cs | 10 +-- ...etworkResurrector.WakeOnLan.Inhouse.csproj | 2 +- ...NetworkResurrector.WakeOnLan.Nikeee.csproj | 2 +- 55 files changed, 182 insertions(+), 331 deletions(-) delete mode 100644 src/agent/NetworkResurrector.Agent/Extensions/Serilog/Sinks/MSSqlServer/ColumnOptionsExtension.cs rename src/agent/NetworkResurrector.Agent/{Startup.cs => Extensions/StartupExtensions.cs} (60%) delete mode 100644 src/agent/NetworkResurrector.Agent/appsettings.Development.json rename src/api/NetworkResurrector.Api/{Startup.cs => Extensions/StartupExtensions.cs} (67%) delete mode 100644 src/api/NetworkResurrector.Api/Notes/Docker-amd64.txt delete mode 100644 src/api/NetworkResurrector.Api/Notes/Docker-arm32v7.txt diff --git a/Directory.Build.props b/Directory.Build.props index 14578a5..ebb2e87 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 1.0.7 + 1.1.0 Tudor Stanciu STA NetworkResurrector diff --git a/ReleaseNotes.xml b/ReleaseNotes.xml index 476a62c..75ee6d7 100644 --- a/ReleaseNotes.xml +++ b/ReleaseNotes.xml @@ -38,4 +38,10 @@ • Exposing two new methods "/ping" and "/version" in a new controller "/system". + + 1.1.0 + + .NET 6 upgrade + + \ No newline at end of file diff --git a/dependencies.props b/dependencies.props index 2493739..7c62508 100644 --- a/dependencies.props +++ b/dependencies.props @@ -1,18 +1,18 @@ - 5.0.0 - 5.0.1 - 4.1.0 - 3.1.0 - 4.0.0 - 5.6.1 - 10.1.1 - 8.1.1 - 6.0.0 - 5.0.12 - 1.0.4 - 1.0.0 - 1.0.7 - 1.1.3 + 6.0.0 + 6.0.1 + 4.1.0 + 3.1.0 + 4.0.1 + 5.6.1 + 10.1.1 + 8.1.1 + 9.0.0 + 6.0.1 + 1.0.6 + 1.0.1 + 1.0.8 + 1.2.0 \ No newline at end of file diff --git a/src/agent/NetworkResurrector.Agent.Application/NetworkResurrector.Agent.Application.csproj b/src/agent/NetworkResurrector.Agent.Application/NetworkResurrector.Agent.Application.csproj index d6b8d25..4bcb0f3 100644 --- a/src/agent/NetworkResurrector.Agent.Application/NetworkResurrector.Agent.Application.csproj +++ b/src/agent/NetworkResurrector.Agent.Application/NetworkResurrector.Agent.Application.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 @@ -10,7 +10,7 @@ - + diff --git a/src/agent/NetworkResurrector.Agent.Application/Queries/GetSystemVersion.cs b/src/agent/NetworkResurrector.Agent.Application/Queries/GetSystemVersion.cs index 1e50f34..0a38be8 100644 --- a/src/agent/NetworkResurrector.Agent.Application/Queries/GetSystemVersion.cs +++ b/src/agent/NetworkResurrector.Agent.Application/Queries/GetSystemVersion.cs @@ -1,5 +1,5 @@ using MediatR; -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using System; using System.Threading; using System.Threading.Tasks; diff --git a/src/agent/NetworkResurrector.Agent.Domain/NetworkResurrector.Agent.Domain.csproj b/src/agent/NetworkResurrector.Agent.Domain/NetworkResurrector.Agent.Domain.csproj index f208d30..dbc1517 100644 --- a/src/agent/NetworkResurrector.Agent.Domain/NetworkResurrector.Agent.Domain.csproj +++ b/src/agent/NetworkResurrector.Agent.Domain/NetworkResurrector.Agent.Domain.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 diff --git a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Cancel.cs b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Cancel.cs index 6e200d4..6a0b252 100644 --- a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Cancel.cs +++ b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Cancel.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Agent.PublishedLanguage.Dto; using NetworkResurrector.Agent.PublishedLanguage.Events; diff --git a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Lock.cs b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Lock.cs index f91c110..68c41f6 100644 --- a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Lock.cs +++ b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Lock.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Agent.PublishedLanguage.Dto; using NetworkResurrector.Agent.PublishedLanguage.Events; diff --git a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Logout.cs b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Logout.cs index ce364cd..29eada9 100644 --- a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Logout.cs +++ b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Logout.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Agent.PublishedLanguage.Dto; using NetworkResurrector.Agent.PublishedLanguage.Events; diff --git a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Restart.cs b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Restart.cs index 3775264..e680b1c 100644 --- a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Restart.cs +++ b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Restart.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Agent.PublishedLanguage.Dto; using NetworkResurrector.Agent.PublishedLanguage.Events; diff --git a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Shutdown.cs b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Shutdown.cs index 915ef16..465442a 100644 --- a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Shutdown.cs +++ b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Shutdown.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Agent.PublishedLanguage.Dto; using NetworkResurrector.Agent.PublishedLanguage.Events; diff --git a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Sleep.cs b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Sleep.cs index 79090cf..531580a 100644 --- a/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Sleep.cs +++ b/src/agent/NetworkResurrector.Agent.PublishedLanguage/Commands/Sleep.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Agent.PublishedLanguage.Dto; using NetworkResurrector.Agent.PublishedLanguage.Events; diff --git a/src/agent/NetworkResurrector.Agent.PublishedLanguage/NetworkResurrector.Agent.PublishedLanguage.csproj b/src/agent/NetworkResurrector.Agent.PublishedLanguage/NetworkResurrector.Agent.PublishedLanguage.csproj index dc8ed30..75ad389 100644 --- a/src/agent/NetworkResurrector.Agent.PublishedLanguage/NetworkResurrector.Agent.PublishedLanguage.csproj +++ b/src/agent/NetworkResurrector.Agent.PublishedLanguage/NetworkResurrector.Agent.PublishedLanguage.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Network resurrector agent published language nuget package https://dev.azure.com/tstanciu94/NetworkResurrector https://dev.azure.com/tstanciu94/NetworkResurrector @@ -9,7 +9,7 @@ - + diff --git a/src/agent/NetworkResurrector.Agent.Wrapper/NetworkResurrector.Agent.Wrapper.csproj b/src/agent/NetworkResurrector.Agent.Wrapper/NetworkResurrector.Agent.Wrapper.csproj index 6422dc6..bb288c2 100644 --- a/src/agent/NetworkResurrector.Agent.Wrapper/NetworkResurrector.Agent.Wrapper.csproj +++ b/src/agent/NetworkResurrector.Agent.Wrapper/NetworkResurrector.Agent.Wrapper.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Network resurrector agent wrapper nuget package https://dev.azure.com/tstanciu94/NetworkResurrector Git diff --git a/src/agent/NetworkResurrector.Agent/Extensions/Serilog/Sinks/MSSqlServer/ColumnOptionsExtension.cs b/src/agent/NetworkResurrector.Agent/Extensions/Serilog/Sinks/MSSqlServer/ColumnOptionsExtension.cs deleted file mode 100644 index be057af..0000000 --- a/src/agent/NetworkResurrector.Agent/Extensions/Serilog/Sinks/MSSqlServer/ColumnOptionsExtension.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Serilog.Sinks.MSSqlServer; - -namespace NetworkResurrector.Agent.Extensions.Serilog.Sinks.MSSqlServer -{ - public static class ColumnOptionsExtension - { - public static ColumnOptions AsStandard(this ColumnOptions columnOptions) - { - columnOptions.Store.Remove(StandardColumn.Properties); - columnOptions.Store.Remove(StandardColumn.MessageTemplate); - columnOptions.Store.Add(StandardColumn.LogEvent); - columnOptions.AdditionalColumns = new System.Collections.ObjectModel.Collection - { - new SqlColumn() { ColumnName = "Agent", DataType = System.Data.SqlDbType.VarChar, DataLength = 100 } - }; - - return columnOptions; - } - } -} diff --git a/src/agent/NetworkResurrector.Agent/Startup.cs b/src/agent/NetworkResurrector.Agent/Extensions/StartupExtensions.cs similarity index 60% rename from src/agent/NetworkResurrector.Agent/Startup.cs rename to src/agent/NetworkResurrector.Agent/Extensions/StartupExtensions.cs index 6d542a0..990da1e 100644 --- a/src/agent/NetworkResurrector.Agent/Startup.cs +++ b/src/agent/NetworkResurrector.Agent/Extensions/StartupExtensions.cs @@ -1,38 +1,26 @@ using MediatR; using MediatR.Pipeline; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using NDB.Extensions.Swagger; -using NDB.Extensions.Swagger.Constants; -using NDB.Security.Authentication.Identity; +using Netmash.Extensions.Swagger; +using Netmash.Extensions.Swagger.Constants; +using Netmash.Security.Authentication.Identity; using NetworkResurrector.Agent.Application; using Newtonsoft.Json; using System.Reflection; -namespace NetworkResurrector.Agent +namespace NetworkResurrector.Agent.Extensions { - public class Startup + public static class StartupExtensions { - private readonly IConfiguration _configuration; - - public Startup(IConfiguration configuration) - { - _configuration = configuration; - } - - private string AgentCode => _configuration.GetValue("Agent:Code"); - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) + public static void ConfigureServices(this IServiceCollection services, IConfiguration configuration) { services.AddControllers() .AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc); // Add basic authentication - services.AddIdentityAuthentication(_configuration.GetSection("IdentityServer")["BaseAddress"]); + services.AddIdentityAuthentication(configuration.GetSection("IdentityServer")["BaseAddress"]); // MediatR services.AddMediatR(GetMediatRAssemblies()); @@ -43,7 +31,8 @@ namespace NetworkResurrector.Agent services.AddAutoMapper(typeof(Application.Mappings.MappingProfile).Assembly); // Swagger - services.AddSwagger($"NetworkResurrectorAgent {AgentCode}", AuthorizationType.InhouseIdentity); + var agentCode = configuration.GetValue("Agent:Code"); + services.AddSwagger($"NetworkResurrectorAgent {agentCode}", AuthorizationType.InhouseIdentity); // Data access // services.AddDataAccess(); @@ -52,14 +41,14 @@ namespace NetworkResurrector.Agent services.AddApplicationServices(); } - private Assembly[] GetMediatRAssemblies() + private static Assembly[] GetMediatRAssemblies() { var assembly = typeof(Application.Queries.GetSystemVersion).Assembly; return new Assembly[] { assembly }; } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + public static void Configure(this IApplicationBuilder app, IConfiguration configuration) { // global cors policy app.UseCors(x => x @@ -67,11 +56,6 @@ namespace NetworkResurrector.Agent .AllowAnyMethod() .AllowAnyHeader()); - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); @@ -79,7 +63,9 @@ namespace NetworkResurrector.Agent { endpoints.MapControllers(); }); - app.ConfigureSwagger($"NetworkResurrectorAgent {AgentCode}"); + + var agentCode = configuration.GetValue("Agent:Code"); + app.ConfigureSwagger($"NetworkResurrectorAgent {agentCode}"); } } } diff --git a/src/agent/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj b/src/agent/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj index 18a99ea..3d7b801 100644 --- a/src/agent/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj +++ b/src/agent/NetworkResurrector.Agent/NetworkResurrector.Agent.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 @@ -10,8 +10,8 @@ - - + + diff --git a/src/agent/NetworkResurrector.Agent/Program.cs b/src/agent/NetworkResurrector.Agent/Program.cs index d279ac6..a071261 100644 --- a/src/agent/NetworkResurrector.Agent/Program.cs +++ b/src/agent/NetworkResurrector.Agent/Program.cs @@ -1,16 +1,14 @@ +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; +using NetworkResurrector.Agent.Extensions; using NetworkResurrector.Agent.Extensions.Serilog; -using NetworkResurrector.Agent.Extensions.Serilog.Sinks.MSSqlServer; using Serilog; using Serilog.Core; using Serilog.Events; using Serilog.Sinks.MSSqlServer; using System; -using System.Diagnostics; -using System.IO; -using System.Linq; namespace NetworkResurrector.Agent { @@ -18,76 +16,65 @@ namespace NetworkResurrector.Agent { public static void Main(string[] args) { - var isConsole = Debugger.IsAttached || args.Contains("--console"); - if (!isConsole) + var builder = WebApplication.CreateBuilder(args); + + builder.Host.UseSerilog((_, lc) => { - var pathToExe = Process.GetCurrentProcess().MainModule.FileName; - var pathToContentRoot = Path.GetDirectoryName(pathToExe); - Directory.SetCurrentDirectory(pathToContentRoot); - } + var connectionString = builder.Configuration.GetConnectionString("DatabaseConnection"); + var loggingLevelParam = builder.Configuration.GetValue("Logging:LogLevel:Default"); - var configuration = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddEnvironmentVariables() - .Build(); + var loggingLevelOk = Enum.TryParse(loggingLevelParam, out LogEventLevel loggingLevel); + if (!loggingLevelOk) + throw new Exception($"Logging level '{loggingLevelParam}' is not valid."); - var connectionString = configuration.GetConnectionString("DatabaseConnection"); - var loggingLevelParam = configuration.GetValue("Logging:LogLevel:Default"); + var loggingLevelSwitch = new LoggingLevelSwitch(loggingLevel); - var loggingLevelOk = Enum.TryParse(loggingLevelParam, out LogEventLevel loggingLevel); - if (!loggingLevelOk) - throw new Exception($"Logging level '{loggingLevelParam}' is not valid."); + var columnOptions = new ColumnOptions(); + columnOptions.Store.Remove(StandardColumn.Properties); + columnOptions.Store.Remove(StandardColumn.MessageTemplate); + columnOptions.Store.Add(StandardColumn.LogEvent); + var mssqlSinkOptions = new MSSqlServerSinkOptions() { AutoCreateSqlTable = true, TableName = "__Logs_Agent" }; - var loggingLevelSwitch = new LoggingLevelSwitch(loggingLevel); - - var columnOptions = new ColumnOptions().AsStandard(); - var mssqlSinkOptions = new MSSqlServerSinkOptions() { AutoCreateSqlTable = true, TableName = "__Logs_Agent" }; - - Log.Logger = new LoggerConfiguration() + lc .MinimumLevel.ControlledBy(loggingLevelSwitch) .MinimumLevel.Override("Microsoft", LogEventLevel.Warning) .Enrich.FromLogContext() - .Enrich.With(new AgentCodeEventEnricher(configuration)) + .Enrich.With(new AgentCodeEventEnricher(builder.Configuration)) .WriteTo.Console() - .WriteTo.MSSqlServer(connectionString, mssqlSinkOptions, columnOptions: columnOptions) - .CreateLogger(); + .WriteTo.MSSqlServer(connectionString, mssqlSinkOptions, columnOptions: columnOptions); + }); + builder.Services.ConfigureServices(builder.Configuration); + + var useWindowsService = builder.Configuration.GetValue("Host:UseWindowsService"); + if (useWindowsService) + builder.Host.UseWindowsService(); + + var app = builder.Build(); + app.Configure(builder.Configuration); + + var exitCode = 0; try { - var urls = configuration.GetValue("Urls"); - var agentCode = configuration.GetValue("Agent:Code"); + var urls = builder.Configuration.GetValue("Urls"); + var agentCode = builder.Configuration.GetValue("Agent:Code"); Log.Information($"Starting network resurrector agent {agentCode}..."); Log.Information($"Network resurrector agent {agentCode} listening on {urls}"); Log.Information($"Hostname: {Environment.MachineName}"); Console.WriteLine("Application started. Press Ctrl+C to shut down."); - CreateHostBuilder(args, configuration, !isConsole).Build().Run(); + app.Run(); } catch (Exception ex) { Log.Fatal(ex, "Network resurrector agent host terminated unexpectedly"); + exitCode = 1; } finally { Log.CloseAndFlush(); } - } - - public static IHostBuilder CreateHostBuilder(string[] args, IConfiguration configuration, bool useWindowsService) - { - var builder = Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup() - .UseConfiguration(configuration) - .UseSerilog(); - }); - - if (useWindowsService) - builder.UseWindowsService(); - - return builder; + Environment.Exit(exitCode); } } } diff --git a/src/agent/NetworkResurrector.Agent/Properties/PublishProfiles/FolderProfile.pubxml b/src/agent/NetworkResurrector.Agent/Properties/PublishProfiles/FolderProfile.pubxml index f9e04dd..3985073 100644 --- a/src/agent/NetworkResurrector.Agent/Properties/PublishProfiles/FolderProfile.pubxml +++ b/src/agent/NetworkResurrector.Agent/Properties/PublishProfiles/FolderProfile.pubxml @@ -4,16 +4,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - False - False - True + false + false + true Release Any CPU FileSystem bin\Release\net5.0\publish\ FileSystem - net5.0 + net6.0 win-x64 c8c4ca6f-39e2-46fe-89e2-0a81d2f4161e true diff --git a/src/agent/NetworkResurrector.Agent/appsettings.Development.json b/src/agent/NetworkResurrector.Agent/appsettings.Development.json deleted file mode 100644 index 8983e0f..0000000 --- a/src/agent/NetworkResurrector.Agent/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - } -} diff --git a/src/agent/NetworkResurrector.Agent/appsettings.json b/src/agent/NetworkResurrector.Agent/appsettings.json index 853c9c3..9016051 100644 --- a/src/agent/NetworkResurrector.Agent/appsettings.json +++ b/src/agent/NetworkResurrector.Agent/appsettings.json @@ -3,6 +3,9 @@ "ConnectionStrings": { "DatabaseConnection": "Server=#########;Database=#########;User Id=#########;Password=#########;MultipleActiveResultSets=true" }, + "Host": { + "UseWindowsService": true + }, "Logging": { "LogLevel": { "Default": "Debug", diff --git a/src/api/NetworkResurrector.Api.Application/NetworkResurrector.Api.Application.csproj b/src/api/NetworkResurrector.Api.Application/NetworkResurrector.Api.Application.csproj index 96739f9..f982787 100644 --- a/src/api/NetworkResurrector.Api.Application/NetworkResurrector.Api.Application.csproj +++ b/src/api/NetworkResurrector.Api.Application/NetworkResurrector.Api.Application.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 @@ -10,7 +10,7 @@ - + diff --git a/src/api/NetworkResurrector.Api.Application/Queries/GetMachines.cs b/src/api/NetworkResurrector.Api.Application/Queries/GetMachines.cs index 2520f4c..6ffe8b3 100644 --- a/src/api/NetworkResurrector.Api.Application/Queries/GetMachines.cs +++ b/src/api/NetworkResurrector.Api.Application/Queries/GetMachines.cs @@ -1,6 +1,6 @@ using AutoMapper; using MediatR; -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Api.Domain.Repositories; using System.Threading; using System.Threading.Tasks; diff --git a/src/api/NetworkResurrector.Api.Application/Queries/GetSystemVersion.cs b/src/api/NetworkResurrector.Api.Application/Queries/GetSystemVersion.cs index 82d5d87..07cbe48 100644 --- a/src/api/NetworkResurrector.Api.Application/Queries/GetSystemVersion.cs +++ b/src/api/NetworkResurrector.Api.Application/Queries/GetSystemVersion.cs @@ -1,5 +1,5 @@ using MediatR; -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using System; using System.IO; using System.Reflection; diff --git a/src/api/NetworkResurrector.Api.Domain.Data/NetworkResurrector.Api.Domain.Data.csproj b/src/api/NetworkResurrector.Api.Domain.Data/NetworkResurrector.Api.Domain.Data.csproj index d61c954..ecc6078 100644 --- a/src/api/NetworkResurrector.Api.Domain.Data/NetworkResurrector.Api.Domain.Data.csproj +++ b/src/api/NetworkResurrector.Api.Domain.Data/NetworkResurrector.Api.Domain.Data.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 diff --git a/src/api/NetworkResurrector.Api.Domain/NetworkResurrector.Api.Domain.csproj b/src/api/NetworkResurrector.Api.Domain/NetworkResurrector.Api.Domain.csproj index f208d30..dbc1517 100644 --- a/src/api/NetworkResurrector.Api.Domain/NetworkResurrector.Api.Domain.csproj +++ b/src/api/NetworkResurrector.Api.Domain/NetworkResurrector.Api.Domain.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 diff --git a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/CancelAction.cs b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/CancelAction.cs index 69b3d99..e96e957 100644 --- a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/CancelAction.cs +++ b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/CancelAction.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Api.PublishedLanguage.Events; namespace NetworkResurrector.Api.PublishedLanguage.Commands diff --git a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/LockMachine.cs b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/LockMachine.cs index 8e3a865..e687623 100644 --- a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/LockMachine.cs +++ b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/LockMachine.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Api.PublishedLanguage.Events; namespace NetworkResurrector.Api.PublishedLanguage.Commands diff --git a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/LogoutUser.cs b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/LogoutUser.cs index 6977989..f300718 100644 --- a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/LogoutUser.cs +++ b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/LogoutUser.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Api.PublishedLanguage.Events; namespace NetworkResurrector.Api.PublishedLanguage.Commands diff --git a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/PingMachine.cs b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/PingMachine.cs index 3860ba4..5d52157 100644 --- a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/PingMachine.cs +++ b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/PingMachine.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Api.PublishedLanguage.Events; namespace NetworkResurrector.Api.PublishedLanguage.Commands diff --git a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/RestartMachine.cs b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/RestartMachine.cs index 55cd68e..d9c12b2 100644 --- a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/RestartMachine.cs +++ b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/RestartMachine.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Api.PublishedLanguage.Events; namespace NetworkResurrector.Api.PublishedLanguage.Commands diff --git a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/ShutdownMachine.cs b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/ShutdownMachine.cs index 3d7f3b0..87dd6ca 100644 --- a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/ShutdownMachine.cs +++ b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/ShutdownMachine.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Api.PublishedLanguage.Events; namespace NetworkResurrector.Api.PublishedLanguage.Commands diff --git a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/SleepMachine.cs b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/SleepMachine.cs index 5d6af2b..2f80137 100644 --- a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/SleepMachine.cs +++ b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/SleepMachine.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Api.PublishedLanguage.Events; namespace NetworkResurrector.Api.PublishedLanguage.Commands diff --git a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/WakeMachine.cs b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/WakeMachine.cs index 20bc3a6..44b21f5 100644 --- a/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/WakeMachine.cs +++ b/src/api/NetworkResurrector.Api.PublishedLanguage/Commands/WakeMachine.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Api.PublishedLanguage.Events; namespace NetworkResurrector.Api.PublishedLanguage.Commands diff --git a/src/api/NetworkResurrector.Api.PublishedLanguage/NetworkResurrector.Api.PublishedLanguage.csproj b/src/api/NetworkResurrector.Api.PublishedLanguage/NetworkResurrector.Api.PublishedLanguage.csproj index b7ec68a..ea960cf 100644 --- a/src/api/NetworkResurrector.Api.PublishedLanguage/NetworkResurrector.Api.PublishedLanguage.csproj +++ b/src/api/NetworkResurrector.Api.PublishedLanguage/NetworkResurrector.Api.PublishedLanguage.csproj @@ -1,11 +1,11 @@ - net5.0 + net6.0 - + diff --git a/src/api/NetworkResurrector.Api/Docker/amd64/Dockerfile b/src/api/NetworkResurrector.Api/Docker/amd64/Dockerfile index 6407d83..c9a65a1 100644 --- a/src/api/NetworkResurrector.Api/Docker/amd64/Dockerfile +++ b/src/api/NetworkResurrector.Api/Docker/amd64/Dockerfile @@ -1,10 +1,10 @@ #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim AS build WORKDIR /src COPY dependencies.props . COPY Directory.Build.props . diff --git a/src/api/NetworkResurrector.Api/Startup.cs b/src/api/NetworkResurrector.Api/Extensions/StartupExtensions.cs similarity index 67% rename from src/api/NetworkResurrector.Api/Startup.cs rename to src/api/NetworkResurrector.Api/Extensions/StartupExtensions.cs index 32237cb..0a5cf04 100644 --- a/src/api/NetworkResurrector.Api/Startup.cs +++ b/src/api/NetworkResurrector.Api/Extensions/StartupExtensions.cs @@ -1,14 +1,13 @@ -using MediatR; +using MediatR; using MediatR.Pipeline; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using NDB.Extensions.Swagger; -using NDB.Extensions.Swagger.Constants; -using NDB.Infrastructure.DatabaseMigration; -using NDB.Infrastructure.DatabaseMigration.Constants; -using NDB.Security.Authentication.Identity; +using Netmash.Extensions.Swagger; +using Netmash.Extensions.Swagger.Constants; +using Netmash.Infrastructure.DatabaseMigration; +using Netmash.Infrastructure.DatabaseMigration.Constants; +using Netmash.Security.Authentication.Identity; using NetworkResurrector.Agent.Wrapper; using NetworkResurrector.Api.Application; using NetworkResurrector.Api.Domain.Abstractions; @@ -18,25 +17,17 @@ using NetworkResurrector.Server.Wrapper; using Newtonsoft.Json; using System.Reflection; -namespace NetworkResurrector.Api +namespace NetworkResurrector.Api.Extensions { - public class Startup + public static class StartupExtensions { - private readonly IConfiguration _configuration; - - public Startup(IConfiguration configuration) - { - _configuration = configuration; - } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) + public static void ConfigureServices(this IServiceCollection services, IConfiguration configuration) { services.AddControllers() .AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc); // Add basic authentication - services.AddIdentityAuthentication(_configuration.GetSection("IdentityServer")["BaseAddress"]); + services.AddIdentityAuthentication(configuration.GetSection("IdentityServer")["BaseAddress"]); services.AddHttpContextAccessor(); services.AddScoped(); @@ -53,7 +44,7 @@ namespace NetworkResurrector.Api services.AddSwagger("NetworkResurrector API", AuthorizationType.InhouseIdentity); // Add network resurrector server services - services.UseResurrectorServices(_configuration.GetSection("NetworkResurrectorServer")["BaseAddress"]); + services.UseResurrectorServices(configuration.GetSection("NetworkResurrectorServer")["BaseAddress"]); // Add network resurrector agent services services.UseResurrectorAgentServices(); @@ -66,14 +57,13 @@ namespace NetworkResurrector.Api services.AddApplicationServices(); } - private Assembly[] GetMediatRAssemblies() + private static Assembly[] GetMediatRAssemblies() { var assembly = typeof(Application.Queries.GetMachines).Assembly; return new Assembly[] { assembly }; } - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + public static void Configure(this IApplicationBuilder app) { // global cors policy app.UseCors(x => x.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()); diff --git a/src/api/NetworkResurrector.Api/NetworkResurrector.Api.csproj b/src/api/NetworkResurrector.Api/NetworkResurrector.Api.csproj index a4ab6ca..0d47cfe 100644 --- a/src/api/NetworkResurrector.Api/NetworkResurrector.Api.csproj +++ b/src/api/NetworkResurrector.Api/NetworkResurrector.Api.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Linux @@ -11,9 +11,9 @@ - - - + + + diff --git a/src/api/NetworkResurrector.Api/Notes/Docker-amd64.txt b/src/api/NetworkResurrector.Api/Notes/Docker-amd64.txt deleted file mode 100644 index 5b091c3..0000000 --- a/src/api/NetworkResurrector.Api/Notes/Docker-amd64.txt +++ /dev/null @@ -1,40 +0,0 @@ -Docker commands: -***************** - -Create image: ---from solution folder: -docker image build -t "network-resurrector-api:1.0.1" -f "src/api/NetworkResurrector.Api/Docker/amd64/Dockerfile" . - -Run image: -docker run -p 5053:80 -it network-resurrector-api:1.0.1 - -Push image to registry: ---tag image -docker tag network-resurrector-api:1.0.1 alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1 - ---login to registry -docker login --username=admin --password="*********" alpine-nexus:8500 - ---push image -docker push alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1 - -Pull image from registry ---login to registry - ---pull image -docker pull alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1 - -Stop old container -docker stop network-resurrector-api -docker rm network-resurrector-api - -Run container in prod env -docker run -d --name network-resurrector-api --restart=always -p 5008:80 alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1 -docker run -d --name network-resurrector-api --restart=always -p 5008:80 tstanciu/sta-registry:nr-api-1.0.1-arm - -Remove old image -docker rmi alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.0 - -####################################################################################################################################################### -Docker container last version: 1.0.1 -############################################################################################## \ No newline at end of file diff --git a/src/api/NetworkResurrector.Api/Notes/Docker-arm32v7.txt b/src/api/NetworkResurrector.Api/Notes/Docker-arm32v7.txt deleted file mode 100644 index 94b1f3b..0000000 --- a/src/api/NetworkResurrector.Api/Notes/Docker-arm32v7.txt +++ /dev/null @@ -1,33 +0,0 @@ -Docker commands: -***************** - -Create image and push it: ---login to registry -docker login --username=tstanciu --password="*********" - ---from solution folder: -docker buildx build --platform linux/arm/v7 -t "tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7" -f "src/api/NetworkResurrector.Api/Docker/arm32/Dockerfile" --push . - -# With insecure registry -docker buildx build --platform linux/arm/v7 -t "alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1-arm" -f "src/api/NetworkResurrector.Api/Docker/arm32v7/Dockerfile" --push . -https://docs.docker.com/engine/reference/commandline/buildx_create/ -https://stackoverflow.com/questions/63409755/how-to-use-docker-buildx-pushing-image-to-registry-use-http-protocol - - -Pull image from registry ---login to registry - ---pull image -docker pull tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7 - -Stop old container -docker stop network-resurrector-api && docker rm network-resurrector-api - -Run container in prod env -docker run -d --name network-resurrector-api --restart=always -p 5008:80 tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7 - -Remove old image -docker rmi tstanciu/sta-registry:network-resurrector-api-1.0.1-arm32v7 - -docker run -d --name network-resurrector-api --restart=always -p 5008:80 alpine-nexus:8500/network-resurrector/network-resurrector-api:1.0.1 -####################################################################################################################################################### \ No newline at end of file diff --git a/src/api/NetworkResurrector.Api/Program.cs b/src/api/NetworkResurrector.Api/Program.cs index 39f4032..2fe2685 100644 --- a/src/api/NetworkResurrector.Api/Program.cs +++ b/src/api/NetworkResurrector.Api/Program.cs @@ -1,14 +1,13 @@ +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; +using NetworkResurrector.Api.Extensions; using Serilog; using Serilog.Core; using Serilog.Events; using Serilog.Sinks.MSSqlServer; using System; -using System.Diagnostics; -using System.IO; -using System.Linq; namespace NetworkResurrector.Api { @@ -16,76 +15,58 @@ namespace NetworkResurrector.Api { public static void Main(string[] args) { - var isConsole = args.Contains("--console"); - if (!isConsole) + var builder = WebApplication.CreateBuilder(args); + + builder.Host.UseSerilog((_, lc) => { - var pathToExe = Process.GetCurrentProcess().MainModule.FileName; - var pathToContentRoot = Path.GetDirectoryName(pathToExe); - Directory.SetCurrentDirectory(pathToContentRoot); - } + var connectionString = builder.Configuration.GetConnectionString("DatabaseConnection"); + var loggingLevelParam = builder.Configuration.GetValue("Logging:LogLevel:Default"); - var configuration = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) - .AddEnvironmentVariables() - .Build(); + var loggingLevelOk = Enum.TryParse(loggingLevelParam, out LogEventLevel loggingLevel); + if (!loggingLevelOk) + throw new Exception($"Logging level '{loggingLevelParam}' is not valid."); - var connectionString = configuration.GetConnectionString("DatabaseConnection"); - var loggingLevelParam = configuration.GetValue("Logging:LogLevel:Default"); + var loggingLevelSwitch = new LoggingLevelSwitch(loggingLevel); - var loggingLevelOk = Enum.TryParse(loggingLevelParam, out LogEventLevel loggingLevel); - if (!loggingLevelOk) - throw new Exception($"Logging level '{loggingLevelParam}' is not valid."); + var columnOptions = new ColumnOptions(); + columnOptions.Store.Remove(StandardColumn.Properties); + columnOptions.Store.Remove(StandardColumn.MessageTemplate); + columnOptions.Store.Add(StandardColumn.LogEvent); + var mssqlSinkOptions = new MSSqlServerSinkOptions() { AutoCreateSqlTable = true, TableName = "__Logs" }; - var loggingLevelSwitch = new LoggingLevelSwitch(loggingLevel); - - var columnOptions = new ColumnOptions(); - columnOptions.Store.Remove(StandardColumn.Properties); - columnOptions.Store.Remove(StandardColumn.MessageTemplate); - columnOptions.Store.Add(StandardColumn.LogEvent); - - var mssqlSinkOptions = new MSSqlServerSinkOptions() { AutoCreateSqlTable = true, TableName = "__Logs" }; - - Log.Logger = new LoggerConfiguration() + lc .MinimumLevel.ControlledBy(loggingLevelSwitch) .MinimumLevel.Override("Microsoft", LogEventLevel.Warning) .Enrich.FromLogContext() .WriteTo.Console() - .WriteTo.MSSqlServer(connectionString, mssqlSinkOptions, columnOptions: columnOptions) - .CreateLogger(); + .WriteTo.MSSqlServer(connectionString, mssqlSinkOptions, columnOptions: columnOptions); + }); + builder.Services.ConfigureServices(builder.Configuration); + + var app = builder.Build(); + app.Configure(); + + var exitCode = 0; try { - var urls = configuration.GetValue("urls"); + var urls = builder.Configuration.GetValue("urls"); Log.Information("Starting network resurrector API..."); Log.Information($"Network resurrector API listening on {urls}"); Console.WriteLine("Application started. Press Ctrl+C to shut down."); - CreateHostBuilder(args, configuration, !isConsole).Build().Run(); + + app.Run(); } catch (Exception ex) { Log.Fatal(ex, "Network resurrector API host terminated unexpectedly"); + exitCode = 1; } finally { Log.CloseAndFlush(); } - } - - public static IHostBuilder CreateHostBuilder(string[] args, IConfiguration configuration, bool useWindowsService) - { - var builder = Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup() - .UseConfiguration(configuration) - .UseSerilog(); - }); - - if (useWindowsService) - builder.UseWindowsService(); - - return builder; + Environment.Exit(exitCode); } } } diff --git a/src/api/NetworkResurrector.Api/Services/UserService.cs b/src/api/NetworkResurrector.Api/Services/UserService.cs index ae7ed1c..66cc1d9 100644 --- a/src/api/NetworkResurrector.Api/Services/UserService.cs +++ b/src/api/NetworkResurrector.Api/Services/UserService.cs @@ -39,7 +39,7 @@ namespace NetworkResurrector.Api.Services public bool UserIsGuest() { - var userIsGuest = _httpAccessor.HttpContext.User?.Claims.FirstOrDefault(z => z.Type == NDB.Security.Authentication.Identity.Constants.ClaimTypes.IsGuestUser)?.Value; + var userIsGuest = _httpAccessor.HttpContext.User?.Claims.FirstOrDefault(z => z.Type == Netmash.Security.Authentication.Identity.Constants.ClaimTypes.IsGuestUser)?.Value; return !string.IsNullOrEmpty(userIsGuest) && bool.TrueString == userIsGuest; } } diff --git a/src/server/NetworkResurrector.Server.Abstractions/NetworkResurrector.Server.Abstractions.csproj b/src/server/NetworkResurrector.Server.Abstractions/NetworkResurrector.Server.Abstractions.csproj index 9f5c4f4..2b1cffb 100644 --- a/src/server/NetworkResurrector.Server.Abstractions/NetworkResurrector.Server.Abstractions.csproj +++ b/src/server/NetworkResurrector.Server.Abstractions/NetworkResurrector.Server.Abstractions.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0 diff --git a/src/server/NetworkResurrector.Server.Application/NetworkResurrector.Server.Application.csproj b/src/server/NetworkResurrector.Server.Application/NetworkResurrector.Server.Application.csproj index f5441e7..a696523 100644 --- a/src/server/NetworkResurrector.Server.Application/NetworkResurrector.Server.Application.csproj +++ b/src/server/NetworkResurrector.Server.Application/NetworkResurrector.Server.Application.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 diff --git a/src/server/NetworkResurrector.Server.Domain/NetworkResurrector.Server.Domain.csproj b/src/server/NetworkResurrector.Server.Domain/NetworkResurrector.Server.Domain.csproj index 9f5c4f4..2b1cffb 100644 --- a/src/server/NetworkResurrector.Server.Domain/NetworkResurrector.Server.Domain.csproj +++ b/src/server/NetworkResurrector.Server.Domain/NetworkResurrector.Server.Domain.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + net6.0 diff --git a/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/PingMachine.cs b/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/PingMachine.cs index 2b394cb..edf630d 100644 --- a/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/PingMachine.cs +++ b/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/PingMachine.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Server.PublishedLanguage.Events; using System; diff --git a/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/ShutdownMachine.cs b/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/ShutdownMachine.cs index fe63c7e..62ac586 100644 --- a/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/ShutdownMachine.cs +++ b/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/ShutdownMachine.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Server.PublishedLanguage.Events; using System; diff --git a/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/WakeMachine.cs b/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/WakeMachine.cs index 1307d2b..728afea 100644 --- a/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/WakeMachine.cs +++ b/src/server/NetworkResurrector.Server.PublishedLanguage/Commands/WakeMachine.cs @@ -1,4 +1,4 @@ -using NDB.Application.DataContracts; +using Netmash.Application.DataContracts; using NetworkResurrector.Server.PublishedLanguage.Events; using System; diff --git a/src/server/NetworkResurrector.Server.PublishedLanguage/NetworkResurrector.Server.PublishedLanguage.csproj b/src/server/NetworkResurrector.Server.PublishedLanguage/NetworkResurrector.Server.PublishedLanguage.csproj index e0fb10f..d42e72a 100644 --- a/src/server/NetworkResurrector.Server.PublishedLanguage/NetworkResurrector.Server.PublishedLanguage.csproj +++ b/src/server/NetworkResurrector.Server.PublishedLanguage/NetworkResurrector.Server.PublishedLanguage.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 Network resurrector server published language nuget package https://dev.azure.com/tstanciu94/NetworkResurrector Git @@ -10,6 +10,6 @@ - + diff --git a/src/server/NetworkResurrector.Server.Wrapper/NetworkResurrector.Server.Wrapper.csproj b/src/server/NetworkResurrector.Server.Wrapper/NetworkResurrector.Server.Wrapper.csproj index 7fef3b3..2c2a585 100644 --- a/src/server/NetworkResurrector.Server.Wrapper/NetworkResurrector.Server.Wrapper.csproj +++ b/src/server/NetworkResurrector.Server.Wrapper/NetworkResurrector.Server.Wrapper.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 Network resurrector server wrapper nuget package https://dev.azure.com/tstanciu94/NetworkResurrector https://dev.azure.com/tstanciu94/NetworkResurrector diff --git a/src/server/NetworkResurrector.Server/NetworkResurrector.Server.csproj b/src/server/NetworkResurrector.Server/NetworkResurrector.Server.csproj index 84a0b53..e9b7bbe 100644 --- a/src/server/NetworkResurrector.Server/NetworkResurrector.Server.csproj +++ b/src/server/NetworkResurrector.Server/NetworkResurrector.Server.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 @@ -10,8 +10,8 @@ - - + + diff --git a/src/server/NetworkResurrector.Server/Properties/PublishProfiles/FolderProfile.pubxml b/src/server/NetworkResurrector.Server/Properties/PublishProfiles/FolderProfile.pubxml index 15c1758..1d1b2fe 100644 --- a/src/server/NetworkResurrector.Server/Properties/PublishProfiles/FolderProfile.pubxml +++ b/src/server/NetworkResurrector.Server/Properties/PublishProfiles/FolderProfile.pubxml @@ -4,16 +4,16 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - False - False - True + false + false + true Release Any CPU FileSystem bin\Release\net5.0\publish\ FileSystem - net5.0 + net6.0 win-x64 f6600491-5d79-4548-8745-59d9d337d3db true diff --git a/src/server/NetworkResurrector.Server/Startup.cs b/src/server/NetworkResurrector.Server/Startup.cs index 388d5dc..14d9f7e 100644 --- a/src/server/NetworkResurrector.Server/Startup.cs +++ b/src/server/NetworkResurrector.Server/Startup.cs @@ -5,9 +5,9 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using NDB.Extensions.Swagger; -using NDB.Extensions.Swagger.Constants; -using NDB.Security.Authentication.Identity; +using Netmash.Extensions.Swagger; +using Netmash.Extensions.Swagger.Constants; +using Netmash.Security.Authentication.Identity; using NetworkResurrector.Server.Application; using NetworkResurrector.Server.Extensions; using Newtonsoft.Json; @@ -45,7 +45,7 @@ namespace NetworkResurrector.Server typeof(Application.Mappings.MappingProfile).Assembly); // Swagger - services.AddSwagger("NetworkResurrector API", AuthorizationType.InhouseIdentity); + services.AddSwagger("NetworkResurrector Server API", AuthorizationType.InhouseIdentity); // Application services.AddApplicationServices(); @@ -75,7 +75,7 @@ namespace NetworkResurrector.Server { endpoints.MapControllers(); }); - app.ConfigureSwagger("NetworkResurrector API"); + app.ConfigureSwagger("NetworkResurrector Server API"); } private Assembly[] GetMediatRAssemblies() diff --git a/src/server/NetworkResurrector.WakeOnLan.Inhouse/NetworkResurrector.WakeOnLan.Inhouse.csproj b/src/server/NetworkResurrector.WakeOnLan.Inhouse/NetworkResurrector.WakeOnLan.Inhouse.csproj index 1ed583d..4a9af5c 100644 --- a/src/server/NetworkResurrector.WakeOnLan.Inhouse/NetworkResurrector.WakeOnLan.Inhouse.csproj +++ b/src/server/NetworkResurrector.WakeOnLan.Inhouse/NetworkResurrector.WakeOnLan.Inhouse.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net6.0 diff --git a/src/server/NetworkResurrector.WakeOnLan.Nikeee/NetworkResurrector.WakeOnLan.Nikeee.csproj b/src/server/NetworkResurrector.WakeOnLan.Nikeee/NetworkResurrector.WakeOnLan.Nikeee.csproj index aaec578..0145147 100644 --- a/src/server/NetworkResurrector.WakeOnLan.Nikeee/NetworkResurrector.WakeOnLan.Nikeee.csproj +++ b/src/server/NetworkResurrector.WakeOnLan.Nikeee/NetworkResurrector.WakeOnLan.Nikeee.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + net6.0