diff --git a/src/Agent/MsiInstaller/Installer/Product.wxs b/src/Agent/MsiInstaller/Installer/Product.wxs index 37d3db417..68e5daedf 100644 --- a/src/Agent/MsiInstaller/Installer/Product.wxs +++ b/src/Agent/MsiInstaller/Installer/Product.wxs @@ -190,12 +190,13 @@ SPDX-License-Identifier: Apache-2.0 + - + - + NOT Installed @@ -809,6 +810,9 @@ SPDX-License-Identifier: Apache-2.0 COR_ENABLE_PROFILING=1 COR_PROFILER={71DA0A04-7777-4EC6-9643-7D28B46A8A41} NEWRELIC_INSTALL_PATH=[NETAGENTFOLDER] + + COR_PROFILER_PATH_32=[NETAGENT32FOLDER]NewRelic.Profiler.dll + @@ -816,6 +820,9 @@ SPDX-License-Identifier: Apache-2.0 COR_ENABLE_PROFILING=1 COR_PROFILER={71DA0A04-7777-4EC6-9643-7D28B46A8A41} NEWRELIC_INSTALL_PATH=[NETAGENTFOLDER] + + COR_PROFILER_PATH_32=[NETAGENT32FOLDER]NewRelic.Profiler.dll + @@ -827,6 +834,9 @@ SPDX-License-Identifier: Apache-2.0 CORECLR_PROFILER={36032161-FFC0-4B61-B559-F6C5D41BAE5A} CORECLR_NEWRELIC_HOME=[NETAGENTCOMMONFOLDER] NEWRELIC_INSTALL_PATH=[NETAGENTFOLDER] + + CORECLR_PROFILER_PATH_32=[NETAGENT32FOLDER]NewRelic.Profiler.dll + @@ -835,6 +845,9 @@ SPDX-License-Identifier: Apache-2.0 CORECLR_PROFILER={36032161-FFC0-4B61-B559-F6C5D41BAE5A} CORECLR_NEWRELIC_HOME=[NETAGENTCOMMONFOLDER] NEWRELIC_INSTALL_PATH=[NETAGENTFOLDER] + + CORECLR_PROFILER_PATH_32=[NETAGENT32FOLDER]NewRelic.Profiler.dll + diff --git a/src/Agent/MsiInstaller/Installer/ui-banner.bmp b/src/Agent/MsiInstaller/Installer/ui-banner.bmp index 44c3a9217..bbc5d40eb 100644 Binary files a/src/Agent/MsiInstaller/Installer/ui-banner.bmp and b/src/Agent/MsiInstaller/Installer/ui-banner.bmp differ diff --git a/src/Agent/MsiInstaller/Installer/ui-banner.png b/src/Agent/MsiInstaller/Installer/ui-banner.png index 6377c2c95..2117eeeae 100644 Binary files a/src/Agent/MsiInstaller/Installer/ui-banner.png and b/src/Agent/MsiInstaller/Installer/ui-banner.png differ diff --git a/src/Agent/MsiInstaller/Installer/ui-dialog.bmp b/src/Agent/MsiInstaller/Installer/ui-dialog.bmp index a8c814b7f..a317b882c 100644 Binary files a/src/Agent/MsiInstaller/Installer/ui-dialog.bmp and b/src/Agent/MsiInstaller/Installer/ui-dialog.bmp differ diff --git a/src/Agent/MsiInstaller/Installer/ui-dialog.png b/src/Agent/MsiInstaller/Installer/ui-dialog.png index 462b72fcc..fc33cdbe5 100644 Binary files a/src/Agent/MsiInstaller/Installer/ui-dialog.png and b/src/Agent/MsiInstaller/Installer/ui-dialog.png differ diff --git a/src/Agent/MsiInstaller/InstallerActions/CustomActions.cs b/src/Agent/MsiInstaller/InstallerActions/CustomActions.cs index 9f7a76edf..f87bf8d78 100644 --- a/src/Agent/MsiInstaller/InstallerActions/CustomActions.cs +++ b/src/Agent/MsiInstaller/InstallerActions/CustomActions.cs @@ -4,9 +4,11 @@ using System; using System.Diagnostics; using System.IO; +using System.Text; using System.Xml; using System.Xml.XPath; using Microsoft.Deployment.WindowsInstaller; +using Microsoft.Win32; namespace InstallerActions { @@ -184,6 +186,115 @@ public static ActionResult CloseStatusMonitor(Session session) return ActionResult.Success; } + [CustomAction] + public static ActionResult CheckBitness(Session session) + { + try + { + var uninstallPaths = new string[] { + "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall", + "SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall" }; + + // check 64-bit first and then 32-bit if needed. + string displayName = null; + foreach (var path in uninstallPaths) + { + if (string.IsNullOrEmpty(displayName)) + { + displayName = GetDisplayName(path); + } + } + + // didn't find NR so not installed. + if (displayName == null) + { + return ActionResult.Success; + } + + var productName = session["ProductName"]; + if (displayName == productName) + { + return ActionResult.Success; + } + + session.Message(InstallMessage.FatalExit, BuildBitnessErrorRecord(productName)); + return ActionResult.Failure; + } + catch(Exception exception) + { + session.Log("Exception thrown checking bitness:\n{0}", exception); + return ActionResult.Failure; + } + } + + private static string GetDisplayName(string path) + { + try + { + var regKey = Registry.LocalMachine.OpenSubKey(path); + foreach (var subkeyName in regKey.GetSubKeyNames()) + { + // Our key a a guid so skip anything that is not. + if (!subkeyName.StartsWith("{")) + { + continue; + } + + // Some entries are missing the DisplayName value. + var subkey = regKey.OpenSubKey(subkeyName); + if (!HasDisplayName(subkey.GetValueNames())) + { + continue; + } + + var displayName = subkey.GetValue("DisplayName").ToString(); + if (string.IsNullOrEmpty(displayName) || !displayName.StartsWith("New Relic .NET Agent")) + { + continue; + } + + // we have a new relic displayname here. + return displayName; + } + } + catch + {} + + return null; + } + + private static Record BuildBitnessErrorRecord(string productName) + { + var builder = new StringBuilder(); + if (productName == "New Relic .NET Agent (64-bit)") + { + builder.AppendLine("The installed x86 (32-bit) version of the New Relic .NET Agent is not compatible with this 64-bit installer."); + builder.AppendLine(); + builder.AppendLine("Either remove the existing installation or use the x86 (32-bit) installer."); + } + else + { + builder.AppendLine("The installed 64-bit version of the New Relic .NET Agent is not compatible with this x86 (32-bit) installer."); + builder.AppendLine(); + builder.AppendLine("Either remove the existing installation or use the 64-bit installer."); + } + + return new Record { FormatString = builder.ToString() }; + } + + private static bool HasDisplayName(string[] values) + { + for (int i = 0; i < values.Length; i++) + { + if (values[i] == "DisplayName") + { + return true; + } + } + + return false; + } + public static void Log(Session session, string message, params object[] arguments) { session["LogHack"] = String.Format(message, arguments);