如何将 Visual Studio 2017 和组件安装到另一个驱动器?

How to install Visual Studio 2017 and components to another drive?

我有一个小型 SSD 驱动器,只有 2-3 GB 可用空间 space。我需要 .NET 桌面和 C++ 桌面工作负载。我尝试创建离线安装程序,一切顺利,我尝试了 -installPath 选项,但它只影响工作室本身和一些其他组件,而不影响 Windows SDK 和 .NET SDK,它们安装到系统驱动器。

我确实安装了 Windows SDK 和 .NET SDK 到不同的驱动器,但我必须为每个使用独立的安装程序。我想知道是否可以使用 VS 2017 附带的安装程序来完成。

不,VS 安装程序只允许您指定安装该 VS 实例的包的位置(即进入您 do 可以选择的文件夹的任何内容)。目前不允许您指定其他全局包的安装位置。

有人在此主题中提议破解

https://social.msdn.microsoft.com/Forums/en-US/3e7160ef-505e-4c48-a1aa-78e778c13ee0/install-visual-studio-2017-in-d-drive?forum=vssetup

I was able to do this using a Junction. First, I went to the installer and found where the files on C would be installed, even when another drive is selected:

C:\Program Files (x86)\Microsoft Visual Studio\Shared

Then, I created a new folder on H, a much larger SSD. I called it VSSHARED.

Then I opened cmd.exe as an administrator and ran:

mklink /J "C:\Program Files (x86)\Microsoft Visual Studio\Shared" "H\VSSHARED"

The installer, once run, placed all of the shared information into H because it thought it was a folder in C.

下面有一个类似的回复:

enter admin privileges in cmd.exe and enter the lines below

mklink / J "C: \ Program Files (x86) \ Microsoft Visual Studio \ Shared" "F: \ msvs2017 \ shared" mklink / J "C: \ Program Files (x86) \ Microsoft Visual Studio \ Installer" F: \ msvs2017 \ Installer " mklink / J "C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ Enterprise" "F: \ msvs2017 \ Enterprise"

change "F: \ msvs2017" to the mklink target lines by the drive and directory where it will be installed.

have Fun

如果这样做有任何缺点,我会忽略。

编辑:我刚刚注意到有人在评论部分评论了这个解决方案。好吧,我认为将其作为答案并没有什么坏处。