Search code examples
c++visual-studioqtinstallationsystem-paths

Visual Studio: copy installation folder and setup it up to be auto-detected by Qt Creator


I wiped out an old Windows 10 and replaced it with a new Windows 10 by ISO image.

  1. Before wiping out, I copied the folder of Microsoft Visual Studio 2017 Community Edition on old Windows to an external hard disk:
xcopy /E "C:\Program Files (x86)\Microsoft Visual Studio" D:\
  1. Now after reinstalling Windows 10, I copied the VS 2017 folder from external the hard disk to the C:\Program Files (x86)\ folder of new operating system.

  2. I did so to avoid having to download VS 2017 again on new OS.


The problem is other software, like Qt Creator, cannot auto-detect the VS C/C++ compilers. I guess that's because the VS 2017 isn't added to path.


The questions are:

  • What path should I add to system path in order to VS 2017 to be auto-detected by other software like Qt Creator?
  • Is there any script which I can run to automatically integrate the VS 2017 to the rest of the operating system.

Solution

  • To answer the questions in your issue:

    Copying the content of C:\Program Files (x86)\Microsoft Visual Studio folder is not a recommended way to install VS.

    (The complete installation will not only set the Environment variables but also set the related registry keys and values. A simple copy may break this process)

    So we always suggest that users install the VS by vs-installer or offline installation package. (Same like what Zlatomir suggests.)

    To your actual requirements:

    It seems you're just trying to use VC++ compiler in QT Creator instead of developing QT projects in Visual Studio. So build tools for VS package is enough for you.

    See this related issue, if we download Build Tools for VS package with corresponding C++ workload, then we can get the compiler the QT needs. There's no need to install the VS IDE for this situation.

    And if we need C++ compiler from VS2017, download the Build Tools for VS2017, if we need C++ compiler from VS2015, download the Build Tools for VS2015 Update3. Link of old version about VS Tools see here.

    Update:

    From the the link older downloads we can see:

    Choose the download button according to which version we need. We can find both VS2017 build tools package and VS2015's there.

    enter image description here