From 670075995cf1b78d0a66e1a7678fd2facc8958ff Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 9 May 2020 21:08:49 +1000 Subject: Use NATIVE_DLL_SEARCH_DIRECTORIES to support cross-platform wixnative.exe --- src/WixToolset.Core.Native/WixNativeExe.cs | 21 ++++++++++++++++++++- .../WixToolset.Core.Native.nuspec | 4 +--- .../runtime.win.WixToolset.Core.Native.nuspec | 8 ++++---- src/wixnative/wixnative.vcxproj | 7 +------ 4 files changed, 26 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/WixToolset.Core.Native/WixNativeExe.cs b/src/WixToolset.Core.Native/WixNativeExe.cs index 935c2a89..063485d3 100644 --- a/src/WixToolset.Core.Native/WixNativeExe.cs +++ b/src/WixToolset.Core.Native/WixNativeExe.cs @@ -11,6 +11,7 @@ namespace WixToolset.Core.Native internal class WixNativeExe { + private const string WixNativeExeFileName = "wixnative.exe"; private static string PathToWixNativeExe; private readonly string commandLine; @@ -80,7 +81,25 @@ namespace WixToolset.Core.Native { if (String.IsNullOrEmpty(PathToWixNativeExe)) { - var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), "wixnative.x86.exe"); + var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), WixNativeExeFileName); + + if (!File.Exists(path)) + { + var searchDirectoriesString = AppContext.GetData("NATIVE_DLL_SEARCH_DIRECTORIES") as string; + var searchDirectories = searchDirectoriesString?.Split(';'); + if (searchDirectories != null) + { + foreach (string directoryPath in searchDirectories) + { + var possiblePath = Path.Combine(directoryPath, WixNativeExeFileName); + if (File.Exists(possiblePath)) + { + path = possiblePath; + break; + } + } + } + } if (!File.Exists(path)) { diff --git a/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec b/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec index 195ea7b6..1ff5538b 100644 --- a/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec +++ b/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec @@ -25,12 +25,10 @@ + --> diff --git a/src/wixnative/runtime.win.WixToolset.Core.Native.nuspec b/src/wixnative/runtime.win.WixToolset.Core.Native.nuspec index f7697694..59eff4e6 100644 --- a/src/wixnative/runtime.win.WixToolset.Core.Native.nuspec +++ b/src/wixnative/runtime.win.WixToolset.Core.Native.nuspec @@ -14,9 +14,9 @@ - - - - + + + + diff --git a/src/wixnative/wixnative.vcxproj b/src/wixnative/wixnative.vcxproj index 1c1c9010..57afcc0b 100644 --- a/src/wixnative/wixnative.vcxproj +++ b/src/wixnative/wixnative.vcxproj @@ -23,16 +23,11 @@ - - x86 - amd64 - - {8497EC72-B8D0-4272-A9D0-7E9D871CEFBF} Application Console - wixnative.$(NameSuffix) + wixnative v141 Unicode Native component of WixToolset.Core -- cgit v1.2.3-55-g6feb