├── .editorconfig
├── .gitattributes
├── .gitignore
├── LICENSE.md
├── README.md
├── RedistributableChecker.sln
├── RedistributableChecker
├── RedistributableChecker.csproj
└── RedistributablePackage.cs
└── Test
├── Program.cs
└── Test.csproj
/.editorconfig:
--------------------------------------------------------------------------------
1 | root=true
2 |
3 | [*.cs]
4 | indent_style = tab
5 | indent_size = 4
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
262 | nuget.config
263 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 - 2020 Christian Hermann & Contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RedistributableChecker
2 |
3 | [](https://github.com/bitbeans/RedistributableChecker/blob/master/LICENSE.md) [](https://www.nuget.org/packages/RedistributableChecker/)
4 |
5 | ### Can check for the following packages ###
6 | - Microsoft Visual C++ Redistributable Package 2015 - 2019 (x86) :heavy_check_mark:
7 | - Microsoft Visual C++ Redistributable Package 2015 - 2019 (x64) :heavy_check_mark:
8 | - Microsoft Visual C++ Redistributable Package 2017 (x86) :heavy_check_mark:
9 | - Microsoft Visual C++ Redistributable Package 2017 (x64) :heavy_check_mark:
10 | - Microsoft Visual C++ Redistributable Package 2015 (x86) :heavy_check_mark:
11 | - Microsoft Visual C++ Redistributable Package 2015 (x64) :heavy_check_mark:
12 | - Microsoft Visual C++ Redistributable Package 2013 (x86) :heavy_check_mark:
13 | - Microsoft Visual C++ Redistributable Package 2013 (x64) :heavy_check_mark:
14 | - Microsoft Visual C++ Redistributable Package 2012 (x86) :heavy_check_mark:
15 | - Microsoft Visual C++ Redistributable Package 2012 (x64) :heavy_check_mark:
16 | - Microsoft Visual C++ Redistributable Package 2010 (x86) :heavy_check_mark:
17 | - Microsoft Visual C++ Redistributable Package 2010 (x64) :heavy_check_mark:
18 | - Microsoft Visual C++ Redistributable Package 2008 (x86) :heavy_check_mark:
19 | - Microsoft Visual C++ Redistributable Package 2008 (x64) :heavy_check_mark:
20 | - Microsoft Visual C++ Redistributable Package 2005 (x86) :heavy_check_mark:
21 | - Microsoft Visual C++ Redistributable Package 2005 (x64) :heavy_check_mark:
22 |
23 | ```csharp
24 | using RedistributableChecker;
25 |
26 | if (RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2017x64)) {
27 | //go on
28 | }
29 | ```
30 |
31 | Tested on: **Windows 10 (x64)**
32 |
33 | Windows Registry Keys taken from: https://stackoverflow.com/a/34209692/4013391 :green_heart:
34 |
35 |
36 |
--------------------------------------------------------------------------------
/RedistributableChecker.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27004.2005
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RedistributableChecker", "RedistributableChecker\RedistributableChecker.csproj", "{524C9CEC-3592-4289-852C-842521456B86}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj", "{DE412364-213C-4F33-A049-09CBD00EB176}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {524C9CEC-3592-4289-852C-842521456B86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {524C9CEC-3592-4289-852C-842521456B86}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {524C9CEC-3592-4289-852C-842521456B86}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {524C9CEC-3592-4289-852C-842521456B86}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {DE412364-213C-4F33-A049-09CBD00EB176}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {DE412364-213C-4F33-A049-09CBD00EB176}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {DE412364-213C-4F33-A049-09CBD00EB176}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {DE412364-213C-4F33-A049-09CBD00EB176}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {279712FE-73B7-41FD-8B97-5DE97FC35F30}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/RedistributableChecker/RedistributableChecker.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard1.6
5 | 0.2.3
6 | bitbeans
7 | Copyright (c) 2017 - 2020 Christian Hermann & Contributors
8 |
9 | https://github.com/bitbeans/RedistributableChecker
10 | Check if Microsoft Visual C++ Redistributable Packages are installed.
11 |
12 | Check for:
13 | - Visual C++ Redistributable Package 2015 - 2019 (x86)
14 | - Visual C++ Redistributable Package 2015 - 2019 (x64)
15 | - Visual C++ Redistributable Package 2017 (x86)
16 | - Visual C++ Redistributable Package 2017 (x64)
17 | - Visual C++ Redistributable Package 2015 (x86)
18 | - Visual C++ Redistributable Package 2015 (x64)
19 | - Visual C++ Redistributable Package 2013 (x86)
20 | - Visual C++ Redistributable Package 2013 (x64)
21 | - Visual C++ Redistributable Package 2012 (x86)
22 | - Visual C++ Redistributable Package 2012 (x64)
23 | - Visual C++ Redistributable Package 2010 (x86)
24 | - Visual C++ Redistributable Package 2010 (x64)
25 | - Visual C++ Redistributable Package 2008 (x86)
26 | - Visual C++ Redistributable Package 2008 (x64)
27 | - Visual C++ Redistributable Package 2005 (x86)
28 | - Visual C++ Redistributable Package 2005(x64)
29 | Visual C++ Redistributable Package
30 | true
31 | MIT
32 | https://github.com/bitbeans/RedistributableChecker
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/RedistributableChecker/RedistributablePackage.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace RedistributableChecker
6 | {
7 | ///
8 | /// Microsoft Visual C++ Redistributable Package Versions
9 | ///
10 | public enum RedistributablePackageVersion
11 | {
12 | VC2005x86,
13 | VC2005x64,
14 | VC2008x86,
15 | VC2008x64,
16 | VC2010x86,
17 | VC2010x64,
18 | VC2012x86,
19 | VC2012x64,
20 | VC2013x86,
21 | VC2013x64,
22 | VC2015x86,
23 | VC2015x64,
24 | VC2017x86,
25 | VC2017x64,
26 | VC2015to2019x86,
27 | VC2015to2019x64,
28 | };
29 |
30 | ///
31 | /// Class to detect installed Microsoft Redistributable Packages.
32 | ///
33 | ///
34 | public static class RedistributablePackage
35 | {
36 | ///
37 | /// Check if a Microsoft Redistributable Package is installed.
38 | ///
39 | /// The package version to detect.
40 | /// true if the package is installed, otherwise false
41 | public static bool IsInstalled(RedistributablePackageVersion redistributableVersion)
42 | {
43 | try
44 | {
45 | switch (redistributableVersion)
46 | {
47 | case RedistributablePackageVersion.VC2015to2019x86:
48 | var parametersVc2015to2019x86 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\DevDiv\VC\Servicing\14.0\RuntimeMinimum", false);
49 | if (parametersVc2015to2019x86 == null) return false;
50 | var vc2015to2019x86Version = parametersVc2015to2019x86.GetValue("Version");
51 | if (((string)vc2015to2019x86Version).StartsWith("14"))
52 | {
53 | return true;
54 | }
55 | break;
56 | case RedistributablePackageVersion.VC2015to2019x64:
57 | var parametersVc2015to2019x64 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\DevDiv\VC\Servicing\14.0\RuntimeMinimum", false);
58 | if (parametersVc2015to2019x64 == null) return false;
59 | var vc2015to2019x64Version = parametersVc2015to2019x64.GetValue("Version");
60 | if (((string)vc2015to2019x64Version).StartsWith("14"))
61 | {
62 | return true;
63 | }
64 | break;
65 | case RedistributablePackageVersion.VC2017x86:
66 | var paths2017x86 = new List
67 | {
68 | @"Installer\Dependencies\,,x86,14.0,bundle",
69 | @"Installer\Dependencies\VC,redist.x86,x86,14.16,bundle" //changed in 14.16.x
70 | };
71 | foreach (var path in paths2017x86)
72 | {
73 | var parametersVc2017x86 = Registry.ClassesRoot.OpenSubKey(path, false);
74 | if (parametersVc2017x86 == null) continue;
75 | var vc2017x86Version = parametersVc2017x86.GetValue("Version");
76 | if (vc2017x86Version == null) return false;
77 | if (((string)vc2017x86Version).StartsWith("14"))
78 | {
79 | return true;
80 | }
81 | }
82 | break;
83 | case RedistributablePackageVersion.VC2017x64:
84 | var paths2017x64 = new List
85 | {
86 | @"Installer\Dependencies\,,amd64,14.0,bundle",
87 | @"Installer\Dependencies\VC,redist.x64,amd64,14.16,bundle" //changed in 14.16.x
88 | };
89 | foreach (var path in paths2017x64)
90 | {
91 | var parametersVc2017x64 = Registry.ClassesRoot.OpenSubKey(path, false);
92 | if (parametersVc2017x64 == null) continue;
93 | var vc2017x64Version = parametersVc2017x64.GetValue("Version");
94 | if (vc2017x64Version == null) return false;
95 | if (((string)vc2017x64Version).StartsWith("14"))
96 | {
97 | return true;
98 | }
99 | }
100 | break;
101 | case RedistributablePackageVersion.VC2015x86:
102 | var parametersVc2015x86 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Dependencies\{e2803110-78b3-4664-a479-3611a381656a}", false);
103 | if (parametersVc2015x86 == null) return false;
104 | var vc2015x86Version = parametersVc2015x86.GetValue("Version");
105 | if (((string)vc2015x86Version).StartsWith("14"))
106 | {
107 | return true;
108 | }
109 | break;
110 | case RedistributablePackageVersion.VC2015x64:
111 | var parametersVc2015x64 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Dependencies\{d992c12e-cab2-426f-bde3-fb8c53950b0d}", false);
112 | if (parametersVc2015x64 == null) return false;
113 | var vc2015x64Version = parametersVc2015x64.GetValue("Version");
114 | if (((string)vc2015x64Version).StartsWith("14"))
115 | {
116 | return true;
117 | }
118 | break;
119 | case RedistributablePackageVersion.VC2013x86:
120 | var parametersVc2013x86 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Dependencies\{f65db027-aff3-4070-886a-0d87064aabb1}", false);
121 | if (parametersVc2013x86 == null) return false;
122 | var vc2013x86Version = parametersVc2013x86.GetValue("Version");
123 | if (((string)vc2013x86Version).StartsWith("12"))
124 | {
125 | return true;
126 | }
127 | break;
128 | case RedistributablePackageVersion.VC2013x64:
129 | var parametersVc2013x64 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Dependencies\{050d4fc8-5d48-4b8f-8972-47c82c46020f}", false);
130 | if (parametersVc2013x64 == null) return false;
131 | var vc2013x64Version = parametersVc2013x64.GetValue("Version");
132 | if (((string)vc2013x64Version).StartsWith("12"))
133 | {
134 | return true;
135 | }
136 | break;
137 | case RedistributablePackageVersion.VC2012x86:
138 | var parametersVc2012x86 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Dependencies\{33d1fd90-4274-48a1-9bc1-97e33d9c2d6f}", false);
139 | if (parametersVc2012x86 == null) return false;
140 | var vc2012x86Version = parametersVc2012x86.GetValue("Version");
141 | if (((string)vc2012x86Version).StartsWith("11"))
142 | {
143 | return true;
144 | }
145 | break;
146 | case RedistributablePackageVersion.VC2012x64:
147 | var parametersVc2012x64 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}", false);
148 | if (parametersVc2012x64 == null) return false;
149 | var vc2012x64Version = parametersVc2012x64.GetValue("Version");
150 | if (((string)vc2012x64Version).StartsWith("11"))
151 | {
152 | return true;
153 | }
154 | break;
155 | case RedistributablePackageVersion.VC2010x86:
156 | var parametersVc2010x86 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Products\1D5E3C0FEDA1E123187686FED06E995A", false);
157 | if (parametersVc2010x86 == null) return false;
158 | var vc2010x86Version = parametersVc2010x86.GetValue("Version");
159 | if ((int)vc2010x86Version > 1)
160 | {
161 | return true;
162 | }
163 | break;
164 | case RedistributablePackageVersion.VC2010x64:
165 | var parametersVc2010x64 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Products\1926E8D15D0BCE53481466615F760A7F", false);
166 | if (parametersVc2010x64 == null) return false;
167 | var vc2010x64Version = parametersVc2010x64.GetValue("Version");
168 | if ((int)vc2010x64Version > 1)
169 | {
170 | return true;
171 | }
172 | break;
173 | case RedistributablePackageVersion.VC2008x86:
174 | var parametersVc2008x86 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Products\6E815EB96CCE9A53884E7857C57002F0", false);
175 | if (parametersVc2008x86 == null) return false;
176 | var vc2008x86Version = parametersVc2008x86.GetValue("Version");
177 | if ((int)vc2008x86Version > 1)
178 | {
179 | return true;
180 | }
181 | break;
182 | case RedistributablePackageVersion.VC2008x64:
183 | var parametersVc2008x64 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Products\67D6ECF5CD5FBA732B8B22BAC8DE1B4D", false);
184 | if (parametersVc2008x64 == null) return false;
185 | var vc2008x64Version = parametersVc2008x64.GetValue("Version");
186 | if ((int)vc2008x64Version > 1)
187 | {
188 | return true;
189 | }
190 | break;
191 | case RedistributablePackageVersion.VC2005x86:
192 | var parametersVc2005x86 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Products\c1c4f01781cc94c4c8fb1542c0981a2a", false);
193 | if (parametersVc2005x86 == null) return false;
194 | var vc2005x86Version = parametersVc2005x86.GetValue("Version");
195 | if ((int)vc2005x86Version > 1)
196 | {
197 | return true;
198 | }
199 | break;
200 | case RedistributablePackageVersion.VC2005x64:
201 | var parametersVc2005x64 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Products\1af2a8da7e60d0b429d7e6453b3d0182", false);
202 | if (parametersVc2005x64 == null) return false;
203 | var vc2005x64Version = parametersVc2005x64.GetValue("Version");
204 | if ((int)vc2005x64Version > 1)
205 | {
206 | return true;
207 | }
208 | break;
209 | }
210 | return false;
211 | }
212 | catch (Exception)
213 | {
214 | return false;
215 | }
216 | }
217 | }
218 | }
219 |
--------------------------------------------------------------------------------
/Test/Program.cs:
--------------------------------------------------------------------------------
1 | using RedistributableChecker;
2 | using System;
3 |
4 | namespace Test
5 | {
6 | class Program
7 | {
8 | static void Main()
9 | {
10 | Console.WriteLine("VC2005x64 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2005x64));
11 | Console.WriteLine("VC2005x86 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2005x86));
12 | Console.WriteLine("VC2008x64 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2008x64));
13 | Console.WriteLine("VC2008x86 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2008x86));
14 | Console.WriteLine("VC2010x64 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2010x64));
15 | Console.WriteLine("VC2010x86 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2010x86));
16 | Console.WriteLine("VC2012x64 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2012x64));
17 | Console.WriteLine("VC2012x86 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2012x86));
18 | Console.WriteLine("VC2013x64 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2013x64));
19 | Console.WriteLine("VC2013x86 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2013x86));
20 | Console.WriteLine("VC2015x64 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2015x64));
21 | Console.WriteLine("VC2015x86 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2015x86));
22 | Console.WriteLine("VC2017x64 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2017x64));
23 | Console.WriteLine("VC2017x86 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2017x86));
24 | Console.WriteLine("VC2015-2019x64 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2015to2019x64));
25 | Console.WriteLine("VC2015-2019x86 installed {0}", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2015to2019x86));
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Test/Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp2.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------