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 | |
| 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
| -rw-r--r-- | src/WixToolset.Core.Native/WixNativeExe.cs | 21 | ||||
| -rw-r--r-- | src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec | 4 | ||||
| -rw-r--r-- | src/wixnative/runtime.win.WixToolset.Core.Native.nuspec | 8 | ||||
| -rw-r--r-- | src/wixnative/wixnative.vcxproj | 7 |
4 files changed, 26 insertions, 14 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> |
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 @@ | |||
| 14 | </metadata> | 14 | </metadata> |
| 15 | 15 | ||
| 16 | <files> | 16 | <files> |
| 17 | <file src="Win32\wixnative.x86.exe" target="runtimes\win-x86\native" /> | 17 | <file src="Win32\wixnative.exe" target="runtimes\win-x86\native" /> |
| 18 | <file src="Win32\wixnative.x86.pdb" target="runtimes\win-x86\native" /> | 18 | <file src="Win32\wixnative.pdb" target="runtimes\win-x86\native" /> |
| 19 | <file src="x64\wixnative.amd64.exe" target="runtimes\win-x64\native" /> | 19 | <file src="x64\wixnative.exe" target="runtimes\win-x64\native" /> |
| 20 | <file src="x64\wixnative.amd64.pdb" target="runtimes\win-x64\native" /> | 20 | <file src="x64\wixnative.pdb" target="runtimes\win-x64\native" /> |
| 21 | </files> | 21 | </files> |
| 22 | </package> | 22 | </package> |
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 @@ | |||
| 23 | </ProjectConfiguration> | 23 | </ProjectConfiguration> |
| 24 | </ItemGroup> | 24 | </ItemGroup> |
| 25 | 25 | ||
| 26 | <PropertyGroup> | ||
| 27 | <NameSuffix Condition=" '$(Platform)'=='Win32' ">x86</NameSuffix> | ||
| 28 | <NameSuffix Condition=" '$(Platform)'=='x64' ">amd64</NameSuffix> | ||
| 29 | </PropertyGroup> | ||
| 30 | |||
| 31 | <PropertyGroup Label="Globals"> | 26 | <PropertyGroup Label="Globals"> |
| 32 | <ProjectGuid>{8497EC72-B8D0-4272-A9D0-7E9D871CEFBF}</ProjectGuid> | 27 | <ProjectGuid>{8497EC72-B8D0-4272-A9D0-7E9D871CEFBF}</ProjectGuid> |
| 33 | <ConfigurationType>Application</ConfigurationType> | 28 | <ConfigurationType>Application</ConfigurationType> |
| 34 | <ProjectSubSystem>Console</ProjectSubSystem> | 29 | <ProjectSubSystem>Console</ProjectSubSystem> |
| 35 | <TargetName>wixnative.$(NameSuffix)</TargetName> | 30 | <TargetName>wixnative</TargetName> |
| 36 | <PlatformToolset>v141</PlatformToolset> | 31 | <PlatformToolset>v141</PlatformToolset> |
| 37 | <CharacterSet>Unicode</CharacterSet> | 32 | <CharacterSet>Unicode</CharacterSet> |
| 38 | <Description>Native component of WixToolset.Core</Description> | 33 | <Description>Native component of WixToolset.Core</Description> |
