Skip to content

Commit 6873112

Browse files
committed
More flexibly handling discovery of VS version in post-2015 registry keys, fixes #24
1 parent 89abc7d commit 6873112

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

ReadableExpressions.Visualizers.Installer.Custom/VsPost2017Data.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace AgileObjects.ReadableExpressions.Visualizers.Installer.Custom
88

99
internal class VsPost2017Data : IDisposable
1010
{
11-
private static readonly Dictionary<string, string> _vsVersionsByYear = new Dictionary<string, string>
11+
private static readonly Dictionary<int, string> _vsVersionsByYear = new Dictionary<int, string>
1212
{
13-
["2017"] = "15.0"
13+
[2017] = "15.0"
1414
};
1515

1616
public VsPost2017Data(RegistryKey post2015Key)
@@ -36,15 +36,15 @@ private static string GetVsFullVersion(RegistryKey capabilitiesKey)
3636
{
3737
return null;
3838
}
39-
40-
var vsYearNumber = appName.TrimEnd().Split(' ').LastOrDefault();
4139

42-
if (vsYearNumber == null)
43-
{
44-
return null;
45-
}
40+
var vsYearNumber = appName
41+
.TrimEnd()
42+
.Split(' ')
43+
.Reverse()
44+
.Select(segment => int.TryParse(segment, out var yearNumber) ? yearNumber : default(int?))
45+
.FirstOrDefault(yearNumber => yearNumber != default(int?));
4646

47-
return _vsVersionsByYear.TryGetValue(vsYearNumber, out var vsVersionNumber)
47+
return vsYearNumber.HasValue && _vsVersionsByYear.TryGetValue(vsYearNumber.Value, out var vsVersionNumber)
4848
? vsVersionNumber : null;
4949
}
5050

ReadableExpressions.Visualizers.Installer/Product.wxs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
<Product Id="*" Version="1.13.0.0" Name="AgileObjects.ReadableExpressions.Visualizers"
3+
<Product Id="*" Version="1.13.1.0" Name="AgileObjects.ReadableExpressions.Visualizers"
44
Language="1033" Manufacturer="AgileObjects" UpgradeCode="BB7C528F-ECFD-45F2-B50C-9F0A71EC8BE9">
55

66
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
@@ -37,6 +37,7 @@
3737
<UIRef Id="WixUI_Minimal" />
3838
</UI>
3939
<WixVariable Id="WixUILicenseRtf" Value=".\license.rtf" />
40+
<Property Id="WIXUI_EXITDIALOGOPTIONALTEXT" Value="Please report any issues using GitHub at https://github.com/agileobjects/ReadableExpressions"/>
4041

4142
<InstallExecuteSequence>
4243
<Custom Action="VisualizersInstall" After="InstallInitialize">

0 commit comments

Comments
 (0)