diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-05-09 21:08:49 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-05-09 21:11:56 +1000 |
| commit | 670075995cf1b78d0a66e1a7678fd2facc8958ff (patch) | |
| tree | df7f699b85e34bb8f487fdad64aaaa9cb8dbfe9f /src/WixToolset.Core.Native | |
| parent | df6e15e2b026f8a419fb275c0b50c9d3b3298859 (diff) | |
| download | wix-670075995cf1b78d0a66e1a7678fd2facc8958ff.tar.gz wix-670075995cf1b78d0a66e1a7678fd2facc8958ff.tar.bz2 wix-670075995cf1b78d0a66e1a7678fd2facc8958ff.zip | |
Use NATIVE_DLL_SEARCH_DIRECTORIES to support cross-platform wixnative.exe
Diffstat (limited to 'src/WixToolset.Core.Native')
| -rw-r--r-- | src/WixToolset.Core.Native/WixNativeExe.cs | 21 | ||||
| -rw-r--r-- | src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec | 4 |
2 files changed, 21 insertions, 4 deletions
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 | |||
| 11 | 11 | ||
| 12 | internal class WixNativeExe | 12 | internal class WixNativeExe |
| 13 | { | 13 | { |
| 14 | private const string WixNativeExeFileName = "wixnative.exe"; | ||
| 14 | private static string PathToWixNativeExe; | 15 | private static string PathToWixNativeExe; |
| 15 | 16 | ||
| 16 | private readonly string commandLine; | 17 | private readonly string commandLine; |
| @@ -80,7 +81,25 @@ namespace WixToolset.Core.Native | |||
| 80 | { | 81 | { |
| 81 | if (String.IsNullOrEmpty(PathToWixNativeExe)) | 82 | if (String.IsNullOrEmpty(PathToWixNativeExe)) |
| 82 | { | 83 | { |
| 83 | var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), "wixnative.x86.exe"); | 84 | var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), WixNativeExeFileName); |
| 85 | |||
| 86 | if (!File.Exists(path)) | ||
| 87 | { | ||
| 88 | var searchDirectoriesString = AppContext.GetData("NATIVE_DLL_SEARCH_DIRECTORIES") as string; | ||
| 89 | var searchDirectories = searchDirectoriesString?.Split(';'); | ||
| 90 | if (searchDirectories != null) | ||
| 91 | { | ||
| 92 | foreach (string directoryPath in searchDirectories) | ||
| 93 | { | ||
| 94 | var possiblePath = Path.Combine(directoryPath, WixNativeExeFileName); | ||
| 95 | if (File.Exists(possiblePath)) | ||
| 96 | { | ||
| 97 | path = possiblePath; | ||
| 98 | break; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | } | ||
| 102 | } | ||
| 84 | 103 | ||
| 85 | if (!File.Exists(path)) | 104 | if (!File.Exists(path)) |
| 86 | { | 105 | { |
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 @@ | |||
| 25 | <file src="$id$.dll" target="lib\netstandard2.0" /> | 25 | <file src="$id$.dll" target="lib\netstandard2.0" /> |
| 26 | 26 | ||
| 27 | <!-- | 27 | <!-- |
| 28 | These native executables are included in this .nupkg to place the .exe correctly for tests to work. | ||
| 29 | That are ignored when published. The dependency above is used when publishing the tools. | ||
| 30 | --> | ||
| 31 | <file src="..\Win32\wixnative.x86.exe" target="lib\netstandard2.0" /> | 28 | <file src="..\Win32\wixnative.x86.exe" target="lib\netstandard2.0" /> |
| 32 | <file src="..\Win32\wixnative.x86.pdb" target="lib\netstandard2.0" /> | 29 | <file src="..\Win32\wixnative.x86.pdb" target="lib\netstandard2.0" /> |
| 33 | <file src="..\x64\wixnative.amd64.exe" target="lib\netstandard2.0" /> | 30 | <file src="..\x64\wixnative.amd64.exe" target="lib\netstandard2.0" /> |
| 34 | <file src="..\x64\wixnative.amd64.pdb" target="lib\netstandard2.0" /> | 31 | <file src="..\x64\wixnative.amd64.pdb" target="lib\netstandard2.0" /> |
| 32 | --> | ||
| 35 | </files> | 33 | </files> |
| 36 | </package> | 34 | </package> |
