aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/WixToolset.Core.Native/WixNativeExe.cs36
-rw-r--r--src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec8
-rw-r--r--src/wixnative/wixnative.v3.ncrunchproject5
3 files changed, 35 insertions, 14 deletions
diff --git a/src/WixToolset.Core.Native/WixNativeExe.cs b/src/WixToolset.Core.Native/WixNativeExe.cs
index 90ab0042..3bd340bc 100644
--- a/src/WixToolset.Core.Native/WixNativeExe.cs
+++ b/src/WixToolset.Core.Native/WixNativeExe.cs
@@ -12,16 +12,12 @@ namespace WixToolset.Core.Native
12 internal class WixNativeExe 12 internal class WixNativeExe
13 { 13 {
14 private const int FiveMinutesInMilliseconds = 300000; 14 private const int FiveMinutesInMilliseconds = 300000;
15 private static readonly string PathToWixNativeExe; 15 private static readonly object PathToWixNativeExeLock = new object();
16 private static string PathToWixNativeExe;
16 17
17 private readonly string commandLine; 18 private readonly string commandLine;
18 private readonly List<string> stdinLines = new List<string>(); 19 private readonly List<string> stdinLines = new List<string>();
19 20
20 static WixNativeExe()
21 {
22 PathToWixNativeExe = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), "wixnative.x86.exe");
23 }
24
25 public WixNativeExe(params object[] args) 21 public WixNativeExe(params object[] args)
26 { 22 {
27 this.commandLine = String.Join(" ", QuoteArgumentsAsNecesary(args)); 23 this.commandLine = String.Join(" ", QuoteArgumentsAsNecesary(args));
@@ -39,10 +35,7 @@ namespace WixToolset.Core.Native
39 35
40 public IEnumerable<string> Run() 36 public IEnumerable<string> Run()
41 { 37 {
42 if (!File.Exists(PathToWixNativeExe)) 38 EnsurePathToWixNativeExeSet();
43 {
44 throw new FileNotFoundException($"Could not find internal piece of WiX Toolset at: {PathToWixNativeExe}", PathToWixNativeExe);
45 }
46 39
47 var wixNativeInfo = new ProcessStartInfo(PathToWixNativeExe, this.commandLine) 40 var wixNativeInfo = new ProcessStartInfo(PathToWixNativeExe, this.commandLine)
48 { 41 {
@@ -88,6 +81,29 @@ namespace WixToolset.Core.Native
88 return stdoutLines; 81 return stdoutLines;
89 } 82 }
90 83
84 private static void EnsurePathToWixNativeExeSet()
85 {
86 lock (PathToWixNativeExeLock)
87 {
88 if (String.IsNullOrEmpty(PathToWixNativeExe))
89 {
90 var path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), @"x86\wixnative.x86.exe");
91
92 if (!File.Exists(path))
93 {
94 path = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), "wixnative.x86.exe");
95
96 if (!File.Exists(path))
97 {
98 throw new FileNotFoundException($"Could not find internal piece of WiX Toolset at: {path}", path);
99 }
100 }
101
102 PathToWixNativeExe = path;
103 }
104 }
105 }
106
91 private static IEnumerable<string> QuoteArgumentsAsNecesary(object[] args) 107 private static IEnumerable<string> QuoteArgumentsAsNecesary(object[] args)
92 { 108 {
93 foreach (var arg in args) 109 foreach (var arg in args)
diff --git a/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec b/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec
index 195ea7b6..a99c5ec3 100644
--- a/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec
+++ b/src/WixToolset.Core.Native/WixToolset.Core.Native.nuspec
@@ -28,9 +28,9 @@
28 These native executables are included in this .nupkg to place the .exe correctly for tests to work. 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. 29 That are ignored when published. The dependency above is used when publishing the tools.
30 --> 30 -->
31 <file src="..\Win32\wixnative.x86.exe" target="lib\netstandard2.0" /> 31 <file src="..\Win32\wixnative.x86.exe" target="lib\netstandard2.0\x86" />
32 <file src="..\Win32\wixnative.x86.pdb" target="lib\netstandard2.0" /> 32 <file src="..\Win32\wixnative.x86.pdb" target="lib\netstandard2.0\x86" />
33 <file src="..\x64\wixnative.amd64.exe" target="lib\netstandard2.0" /> 33 <file src="..\x64\wixnative.amd64.exe" target="lib\netstandard2.0\amd64" />
34 <file src="..\x64\wixnative.amd64.pdb" target="lib\netstandard2.0" /> 34 <file src="..\x64\wixnative.amd64.pdb" target="lib\netstandard2.0\amd64" />
35 </files> 35 </files>
36</package> 36</package>
diff --git a/src/wixnative/wixnative.v3.ncrunchproject b/src/wixnative/wixnative.v3.ncrunchproject
new file mode 100644
index 00000000..319cd523
--- /dev/null
+++ b/src/wixnative/wixnative.v3.ncrunchproject
@@ -0,0 +1,5 @@
1<ProjectConfiguration>
2 <Settings>
3 <IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely>
4 </Settings>
5</ProjectConfiguration> \ No newline at end of file