172

Any suggestions on how to deal with this error:

TITLE: Microsoft SQL Server 2017 Setup
------------------------------

The following error has occurred:

VS Shell installation has failed with exit code 1638.

For help, click: https://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft%20SQL%20Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=0x5B39C8B9%25401434%25403

------------------------------
BUTTONS:

OK
------------------------------

This is a new laptop running

  • SQL Server 2016 express
  • Visual Studio 2017
  • SSMS 2017

I tried uninstalling anything related to SQL Server or Visual Studio.

Log: [3500:3970][2017-11-03T16:25:20]e000: Error 0x80070666: Cannot install a product when a newer version is installed.

Detailed results:
  Feature:                       Full-Text and Semantic Extractions for Search
  Status:                        Failed
  Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
  Next Step:                     Use the following information to resolve the error, and then try the setup process again.
  Component name:                Microsoft Visual C++ 2015 Redistributable
  Component error code:          1638
  Component log file:            C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20171103_162358\VCRuntime140_x64_Cpu64_1.log
  Error description:             VS Shell installation has failed with exit code 1638.
  Error help link:               https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=VCRuntime140_x64%40Install%400x1638

  Feature:                       Database Engine Services
  Status:                        Failed
  Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
  Next Step:                     Use the following information to resolve the error, and then try the setup process again.
  Component name:                Microsoft Visual C++ 2015 Redistributable
  Component error code:          1638
  Component log file:            C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20171103_162358\VCRuntime140_x64_Cpu64_1.log
  Error description:             VS Shell installation has failed with exit code 1638.
  Error help link:               https://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=VCRuntime140_x64%40Install%400x1638
1
  • The current answer is very good and detailed, but in my case the order of installation was the issue, VS -> SQL EXPRESS -> SSMS is the correct order Commented Aug 15, 2020 at 16:52

4 Answers 4

327
+50

I experienced this problem as well with SQL Server 2017 Developer and it appears to be just bad planning on the part of the SQL Server installation package people. The problem is that Visual Studio 2017 installs the Microsoft Visual C++ 2017 Redistributable (x86) and (x64) and the SQL Server installation tries to install the Microsoft Visual C++ 2015 Redistributables, which it can't because the SQL Server installation doesn't allow you to install an older version with the newer version installed.

This Microsoft Support article presents their explanation of the problem, and their recommended workarounds.

Solution 1: Install SQL Server first before installing Visual Studio 2017.

Solution 2 (what I did):

  1. Uninstall the Microsoft Visual C++ 2017 Redistributable (x86) and (x64),
  2. install SQL Server,
  3. then reinstall the Microsoft Visual C++ 2017 Redistributable (x86) and (x64).

They are a little hard to find, so here are the direct links:

X64: https://go.microsoft.com/fwlink/?LinkId=746572

x86: https://go.microsoft.com/fwlink/?LinkId=746571

Note: If you don't have Microsoft Visual C++ 2017 Redistributable installed at all, just install it from one of the above links, and retry installing SQL Server. It should work now.


You may have to repeat these steps when installed additional named instances of SQL Server 2017.

7
  • 4
    I had to uninstall 2017 Redist, so I'm confused by your closing comment, asking us to install it? That would cause exactly the problem being addressed here. Download it sure, but don't install it until after Sql Server Express 2017 is installed, or it will never succeed. Commented Jul 25, 2018 at 22:20
  • 1
    In my case, other software installed had interfered with the 2015 runtime installation. The bottom line is that I had to get the 64 bit version of 2015 Microsoft Visual C++ redistributables installed before SQL Server install. By doing that manually, I got better diagnostics than when the SQL Server installation was installing it. Once the 2015 64 bit redistributables were installed, SQL Server installation completed. Use the Add/Remove Programs in Windows to see which versions are installed.
    – nachbar
    Commented Jul 31, 2018 at 22:04
  • I found that installing the referenced libraries and then re-running the SQL Server installation was sufficient. Commented Sep 7, 2018 at 12:12
  • The same problem happens with SQL Server 2019 CTP 2 (and the solution is the same). Commented Sep 27, 2018 at 5:40
  • There is now a “Microsoft Visual C++ 2015-2019 Redistributable” at support.microsoft.com/en-us/help/2977003/… which can be installed on top of the 2017 Redistributable and replaces it, while also providing the 2015 and 2019 Redistributables. I did so after receiving the exit code 1638 error and could then successfully install SQL Server 2017. No uninstallation of redistributables necessary. (Cannot add as alternative answer due to protected status.)
    – Otto G
    Commented Sep 3, 2019 at 9:47
11

I had the same problem but I was upgrading from SQL Server 2016.

I uninstalled Microsoft Visual C++ 2015 Redistributable, both the x86 & x64, then it upgraded successfully.

1
  • This solution also worked for me when I was trying to add features to an existing SQL 2017 installation.
    – Rocky
    Commented Oct 18, 2018 at 17:07
3

I got the error when trying to repair my SQL Server 2017 installation. I found this link VC++ 2015 Redistributable installation returns error 1638 when newer version already installed, which says the issue is fixed in Cumulative Update 13 for SQL Server 2017.

It worked; I applied the update then ran the repair, and it finished without an error.

0

In Windows' list of apps try to run 'repair' for MS Visual C++ Redistributable

Not the answer you're looking for? Browse other questions tagged or ask your own question.