Reputation: 405
i have created an setup.exe,which can be distributable.it has some dependency on visual studio's distributable files.for that reason i want to install the following 2 dependencies(as checked in the NSIS code,if absent then it will be installed),but if any edition/version of visual studio is there then i don't require to install these dependencies.
so i want to know how to check programmatically whether any version/edition of visual studio is present on the system or not,if not i will install my dependencies on my own using the following NSIS script. can some one please give me some idea to do check for any edition/version of Visual Studio present in the system or not using NSIS.......
Section "VS05 Redist (required)" MVR1
ReadRegStr $STRING_REDIST HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{837B34E3-7C30-493C-8F6A-2B0F04E2912C}" "UninstallString"
StrCmp $STRING_REDIST "MsiExec.exe /X{837B34E3-7C30-493C-8F6A-2B0F04E2912C}" +3 0
File "vcredist_x86ATL.exe"
ExecWait "$INSTDIR\vcredist_x86ATL.exe"
SectionEnd
Section "VS08 Redist (required)" MVR2
ReadRegStr $STRING_REDIST HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}" "UninstallString"
StrCmp $STRING_REDIST "MsiExec.exe /X{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}" +3 0
File "vcredist_x86VS2008.exe"
ExecWait "$INSTDIR\vcredist_x86VS2008.exe"
SectionEnd
the above code will check only forVS05 diistribution and VS08distribution,whereas i want to find whether any version of VS is present of not....
Upvotes: 1
Views: 556
Reputation: 11465
You could test the presence of any sub keys in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio
. If there is one, it will give you the version number.
Upvotes: 2