private void InjectManifest() { var targetPortableExecutable = new PortableExecutable(TargetFilePath); var targetManifest = targetPortableExecutable.TryGetManifest(); var appHostPortableExecutable = new PortableExecutable(AppHostFilePath); appHostPortableExecutable.RemoveManifest(); if (!string.IsNullOrWhiteSpace(targetManifest)) { appHostPortableExecutable.SetManifest(targetManifest); Log.LogMessage("Injected manifest into '{0}'.", AppHostFileName); } else { Log.LogMessage("Could not find manifest resource in '{0}'.", TargetFileName); } }