diff --git a/NetcodePatcher.MSBuild.Tasks/NetcodePatchTask.cs b/NetcodePatcher.MSBuild.Tasks/NetcodePatchTask.cs index 14d2b5d..3246341 100644 --- a/NetcodePatcher.MSBuild.Tasks/NetcodePatchTask.cs +++ b/NetcodePatcher.MSBuild.Tasks/NetcodePatchTask.cs @@ -34,7 +34,7 @@ public class NetcodePatchTask : Task public override bool Execute() { Serilog.Log.Logger = new LoggerConfiguration() - .MinimumLevel.Information() + .MinimumLevel.Debug() .WriteTo.MSBuildTask(this) .CreateLogger(); @@ -43,6 +43,12 @@ public override bool Execute() .InformationalVersion; Serilog.Log.Information("Initializing NetcodePatcher v{Version:l}", toolVersion); + if (Patch.Length < 1) + { + Serilog.Log.Information("No targets specified for Netcode patching. NetcodePatcher done."); + return true; + } + var noOverwrite = false; if (!string.IsNullOrEmpty(NoOverwrite)) { @@ -93,6 +99,7 @@ void RunPatch(ITaskItem patchSpecifier) outputPath = Path.Combine(outputPath, noOverwrite ? $"{Path.GetFileNameWithoutExtension(pluginAssembly.Name)}_patched{Path.GetExtension(pluginAssembly.Name)}" : pluginAssembly.Name); } + Serilog.Log.Information("Processing : {input}", inputPath); patchMethod.Invoke(null, [inputPath, outputPath, ReferenceAssemblyPaths.Select(info => info.ItemSpec).ToArray()]); } diff --git a/NetcodePatcher.Tools.Common/PatcherLoadContext.cs b/NetcodePatcher.Tools.Common/PatcherLoadContext.cs index bcb206f..3e89798 100644 --- a/NetcodePatcher.Tools.Common/PatcherLoadContext.cs +++ b/NetcodePatcher.Tools.Common/PatcherLoadContext.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Reflection; using System.Runtime.Loader; +using Serilog; namespace NetcodePatcher.Tools.Common; @@ -27,7 +28,16 @@ public PatcherLoadContext(string name, PatcherConfiguration configuration) : bas if (assemblyName.Name is null) return null; if (SharedDependencyAssemblyNames.Contains(assemblyName.Name)) - return Default.LoadFromAssemblyName(assemblyName); + { + string? sharedPath = ResolveAssemblyToPath(assemblyName); + if (sharedPath is null) + { + Log.Debug("Shared dependency {SharedName} not found in {CommonDir} or {SharedDir}, trying to load from system", assemblyName, _configuration.PatcherCommonAssemblyDir, _configuration.PatcherNetcodeSpecificAssemblyDir); + return Default.LoadFromAssemblyName(assemblyName); + } + Log.Debug("Shared Dependency {SharedName} loading from {Directory}", assemblyName, sharedPath); + return Default.LoadFromAssemblyPath(sharedPath); + } string? assemblyPath = ResolveAssemblyToPath(assemblyName); if (assemblyPath is null) return null;