Skip to content

Commit 1c33a25

Browse files
committed
BuildTools: Fix building with visual studio previews
1 parent 280fd94 commit 1c33a25

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

tools/CustomBuildTool/HeaderGen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public override bool Equals(object obj)
4949
if (obj == null)
5050
return false;
5151

52-
if (!(obj is HeaderFile file))
52+
if (obj is not HeaderFile file)
5353
return false;
5454

5555
return this.Name.Equals(file.Name, StringComparison.OrdinalIgnoreCase);

tools/CustomBuildTool/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace CustomBuildTool
2727
{
2828
public static class Program
2929
{
30-
public static Dictionary<string, string> ProgramArgs;
30+
private static Dictionary<string, string> ProgramArgs;
3131

3232
public static void Main(string[] args)
3333
{

tools/CustomBuildTool/Utils.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static int CreateProcess(string FileName, string args)
5757
public static string ShellExecute(string FileName, string args)
5858
{
5959
string output = string.Empty;
60-
int code = int.MaxValue;
60+
//int code = int.MaxValue;
6161

6262
using (Process process = Process.Start(new ProcessStartInfo
6363
{
@@ -75,7 +75,7 @@ public static string ShellExecute(string FileName, string args)
7575

7676
process.WaitForExit();
7777

78-
code = process.ExitCode;
78+
//code = process.ExitCode;
7979
}
8080

8181
return output;
@@ -394,6 +394,21 @@ public static VisualStudioInstance GetVisualStudioInstance()
394394
catch { }
395395
}
396396

397+
VisualStudioInstanceList.Sort((p1, p2) =>
398+
{
399+
if (Version.TryParse(p1.InstallationVersion, out Version version1) && Version.TryParse(p2.InstallationVersion, out Version version2))
400+
{
401+
if (version1 < version2)
402+
return 1;
403+
else if (version1 > version2)
404+
return -1;
405+
406+
return version1.CompareTo(version2);
407+
}
408+
409+
return 1;
410+
});
411+
397412
foreach (VisualStudioInstance instance in VisualStudioInstanceList)
398413
{
399414
if (
Binary file not shown.

0 commit comments

Comments
 (0)