How to set Environment Variable to force VS 2019 to use 64-bit tools?

I am getting the following info when compiling my Release version of a GUI App, with VS 2019:

1>LINK : the 32-bit linker (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\link.exe) failed to do memory mapped file I/O on `x64\Release\App\xxxx-apphost.iobj' and is going to restart linking with a 64-bit linker for better throughput
1>LINK : restarting link with 64-bit linker `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\link.exe'

It eventually links but this takes way longer.

I have read that you can force VS 2019 to use the 64-bit linker tools (they user 32-bit by default, even if you are building 64-bit projects) by setting an Environment Variable for PreferredToolArchitecture=x64.

I am a Mac User, so this is new to me.

I tried setting like this in System Properties > Advanced > Environment Variables >
by adding a new Variable PreferredToolArchitecture with a value of x64:

… but it appears to have no effect. You can see in the Task Manager it is still using the 32-bit tools:

Why not update to the fully 64 bit Visual Studio 2022?

Good question. Because I’m comfortable with it and worried I’ll mess something up?

Can you install VS 2022 and still keep your VS 2019 installation intact and usable?

Well, VS 2019 gives you problems :slight_smile:

Yes, you can run both versions alongside

1 Like