diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-07-18 23:58:13 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-07-18 23:58:13 -0400 |
| commit | d08f7df3c3607193252889a79b635a48e993fb37 (patch) | |
| tree | 0aae45dbdc37044e4ef640ae4e6646ba5e88bc0a /MediaBrowser.ServerApplication | |
| parent | 757917a63a51139dd3fb283a3f0aa5b743ff2403 (diff) | |
update vcc 2013 check
Diffstat (limited to 'MediaBrowser.ServerApplication')
| -rw-r--r-- | MediaBrowser.ServerApplication/MainStartup.cs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs index 2440eab7c..bdfd7d1bb 100644 --- a/MediaBrowser.ServerApplication/MainStartup.cs +++ b/MediaBrowser.ServerApplication/MainStartup.cs @@ -644,14 +644,32 @@ namespace MediaBrowser.ServerApplication private static async Task InstallVcredist2013IfNeeded(ApplicationHost appHost, ILogger logger) { + // Reference + // http://stackoverflow.com/questions/12206314/detect-if-visual-c-redistributable-for-visual-studio-2012-is-installed + try { - var version = ImageMagickEncoder.GetVersion(); - return; + var subkey = Environment.Is64BitProcess + ? "SOFTWARE\\WOW6432Node\\Microsoft\\VisualStudio\\12.0\\VC\\Runtimes\\x64" + : "SOFTWARE\\Microsoft\\VisualStudio\\12.0\\VC\\Runtimes\\x86"; + + using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Default) + .OpenSubKey(subkey)) + { + if (ndpKey != null && ndpKey.GetValue("Version") != null) + { + var installedVersion = ((string)ndpKey.GetValue("Version")).TrimStart('v'); + if (installedVersion.StartsWith("12", StringComparison.OrdinalIgnoreCase)) + { + return; + } + } + } } catch (Exception ex) { - logger.ErrorException("Error loading ImageMagick", ex); + logger.ErrorException("Error getting .NET Framework version", ex); + return; } try |
