@@ -100,7 +100,7 @@ private static Bundle WrapRegistryKey(RegistryKey registryKey)
100
100
return Bundle . From ( version , arch , uninstallCommand , displayName ) ;
101
101
}
102
102
103
- private static BundleVersion GetBundleVersion ( string displayName , string uninstallString , string bundleCachePath )
103
+ public static BundleVersion GetBundleVersion ( string displayName , string uninstallString , string bundleCachePath )
104
104
{
105
105
var versionString = Regexes . VersionDisplayNameRegex . Match ( displayName ) ? . Value ?? string . Empty ;
106
106
var cachePathMatch = Regexes . BundleCachePathRegex . Match ( bundleCachePath ) ;
@@ -109,27 +109,35 @@ private static BundleVersion GetBundleVersion(string displayName, string uninsta
109
109
string . Format ( LocalizableStrings . HostingBundleFootnoteFormat , displayName , versionString ) :
110
110
null ;
111
111
112
- // Classify the bundle type
113
- if ( displayName . IndexOf ( "Windows Server" , StringComparison . OrdinalIgnoreCase ) >= 0 )
112
+ try
114
113
{
115
- return new HostingBundleVersion ( versionString , footnote ) ;
114
+ // Classify the bundle type
115
+ if ( displayName . IndexOf ( "Windows Server" , StringComparison . OrdinalIgnoreCase ) >= 0 )
116
+ {
117
+ return new HostingBundleVersion ( versionString , footnote ) ;
118
+ }
119
+ else if ( displayName . IndexOf ( "ASP.NET" , StringComparison . OrdinalIgnoreCase ) >= 0 )
120
+ {
121
+ return new AspNetRuntimeVersion ( versionString ) ;
122
+ }
123
+ else if ( ( displayName . IndexOf ( ".NET Core SDK" , StringComparison . OrdinalIgnoreCase ) >= 0 ) ||
124
+ ( displayName . IndexOf ( "Microsoft .NET SDK" , StringComparison . OrdinalIgnoreCase ) >= 0 ) ||
125
+ uninstallString . IndexOf ( "dotnet-dev-win" ) >= 0 )
126
+ {
127
+ return new SdkVersion ( versionString ) ;
128
+ }
129
+ else if ( displayName . IndexOf ( ".NET Core Runtime" , StringComparison . OrdinalIgnoreCase ) >= 0 || Regex . IsMatch ( displayName , @".*\.NET Core.*Runtime" ) ||
130
+ displayName . IndexOf ( ".NET Runtime" , StringComparison . OrdinalIgnoreCase ) >= 0 )
131
+ {
132
+ return new RuntimeVersion ( versionString ) ;
133
+ }
134
+ else
135
+ {
136
+ return null ;
137
+ }
116
138
}
117
- else if ( displayName . IndexOf ( "ASP.NET" , StringComparison . OrdinalIgnoreCase ) >= 0 )
139
+ catch
118
140
{
119
- return new AspNetRuntimeVersion ( versionString ) ;
120
- }
121
- else if ( ( displayName . IndexOf ( ".NET Core SDK" , StringComparison . OrdinalIgnoreCase ) >= 0 ) ||
122
- ( displayName . IndexOf ( "Microsoft .NET SDK" , StringComparison . OrdinalIgnoreCase ) >= 0 ) ||
123
- uninstallString . IndexOf ( "dotnet-dev-win" ) >= 0 )
124
- {
125
- return new SdkVersion ( versionString ) ;
126
- }
127
- else if ( displayName . IndexOf ( ".NET Core Runtime" , StringComparison . OrdinalIgnoreCase ) >= 0 || Regex . IsMatch ( displayName , @".*\.NET Core.*Runtime" ) ||
128
- displayName . IndexOf ( ".NET Runtime" , StringComparison . OrdinalIgnoreCase ) >= 0 )
129
- {
130
- return new RuntimeVersion ( versionString ) ;
131
- }
132
- else {
133
141
return null ;
134
142
}
135
143
}
0 commit comments