Megidd
Megidd

Reputation: 7969

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:

Upvotes: 2

Views: 3844

Answers (2)

LoLance
LoLance

Reputation: 28196

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

Upvotes: 2

Zlatomir
Zlatomir

Reputation: 7034

Usually programs on Windows don't work after you just copy the installation folder. So right now there is little you can do to fix it, even if you partially fix, you have no way to know if something else will be broken in the future.

So the recommended solution is to download the installer again and create an offline installer for the next time this happens, you can do that by running the online installer with the following parameters: vs_community.exe --layout c:\vslayout --lang en-US (replace vs_community.exe with the actual name of the online installer file, or rename it), for more options, that might require a smaller download (example if you only need native and don't need .net) check the documentation here for the full set of options you have.

Upvotes: 2

Related Questions