Hi, I upgraded my project from 2021.1 to the recently released 2021.2 and I'm getting build errors (IL2CPP), it seems Unity is unable to detect Visual Studio Build Tools: Spoiler: Error Message Internal build system error. BuildProgram exited with code -2146233088. error: Could not set up a toolchain for Architecture x64. Make sure you have the right build tools installed for il2cpp builds. Details: IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed: * Visual Studio 2019 or newer with C++ compilers and Windows 10 SDK (recommended) * Visual Studio 2017 with C++ compilers and Windows 10 SDK * Visual Studio 2015 with C++ compilers and Windows 10 SDK Visual Studio 2017 (or newer) is detected using `vswhere.exe` as well as VSCOMNTOOLS environment variables. Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry as well as VSCOMNTOOLS environment variables. Windows 10 SDK is detected by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry. Unable to detect any compatible Visual Studio installation! Unity.IL2CPP.Bee.BuildLogic.ToolchainNotFoundException: IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed: * Visual Studio 2019 or newer with C++ compilers and Windows 10 SDK (recommended) * Visual Studio 2017 with C++ compilers and Windows 10 SDK * Visual Studio 2015 with C++ compilers and Windows 10 SDK Visual Studio 2017 (or newer) is detected using `vswhere.exe` as well as VSCOMNTOOLS environment variables. Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry as well as VSCOMNTOOLS environment variables. Windows 10 SDK is detected by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry. Unable to detect any compatible Visual Studio installation! at Unity.IL2CPP.Bee.BuildLogic.WindowsDesktop.WindowsDesktopBuildLogic.UserAvailableToolchainFor(Architecture architecture, NPath toolChainPath, NPath sysRootPath) at PlayerBuildProgramLibrary.PlayerBuildProgramBase.GetIl2CppToolChain(PlatformBuildLogic platform, Architecture architecture, NPath toolChainPath, NPath sysrootPath) at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupIl2CppBuild() at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupPlayerBuild() at WinPlayerBuildProgram.WinPlayerBuildProgram.SetupPlayerBuild() at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram() at PlayerBuildProgramTypeWrapper.Run(String[] args) at Program.Main(String[] args) UnityEditor.EditorApplication:Internal_CallGlobalEventHandler () However, I'm able to build without any problems with Unity 2021.1 so it seems something changed in 2021.2. Here are the C++ Build Tools components I have installed: I don't really want to install the full Visual Studio Editor just to be able to build in Unity, any ideas of what could be wrong? Thanks in advance.
Hi Sam! Do you mind posting the output of vswhere.exe on your computer? Mine is located at "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
Hi bitter! Sure, here is the output: Using "-format xml" option returns: And if I list all environment variables with "Get-ChildItem Env:" command in powershell I don't see any VSCOMNTOOLS as suggested by the error message in Unity. This is strange, despite the above outputs Unity 2021.1 is somehow able to locate my VS Build Tools 2019 installation since I can build fine there (install path perhaps?), but Unity 2021.2 doesn't. Edit: Not sure if relevant, but "MSBuild.exe" is located under "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin>" in my computer.
Thank you! Unity 2021.2 is using a new build path that should make iterative builds faster. But that also means it's running different detection code for Visual Studio. I will need to dig into the old build path and see what it is in that path that detects Visual Studio installations that vswhere is not aware of. Meanwhile to get you unblocked, try setting VS160COMNTOOLS environment variable to "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools".
I found the issue - https://github.com/microsoft/vswhere/issues/22 Let me know if the workaround using VS160COMNTOOLS worked for you. Meanwhile I'll put in a patch supporting BuildTools.
Awesome, I can confirm that setting VS160COMNTOOLS environment variable did the trick and I'm able to build now, thank you very much! Additionally, I ran "vswhere" command with "-products 'Microsoft.VisualStudio.Product.BuildTools'" option as suggested in the github link you shared and my Visual Studio instance is now listed.
Just to throw out, we ran into this issue as well. Creating the VS160COMNTOOLS environment variable solved this issue for us as well. We use the "Visual Studio Build Tools" installer for our build servers.
I'm having this issue in unity 2021.2 using visual studio 2022 build tools, has there been any work done on this?
Patch has been submitted but has not yet made it into 21.2 yet. Sorry, I should have done a better job at pushing this forward.
Same Issue here, setting environment variables didnt resolve. Edit: I didn't have desktop development with C++ installed via VS tools as I just relied on the unity hub for installing everything. I installed this and it now builds.
I can't find a way to solve this issue. I'm using Unity 2021.2.14f and Visual Studio 2022 17.1.2. What I tried: Setting VS160COMNTOOLS user environment variable to C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools Setting VS170COMNTOOLS user environment variable to C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools Installing Desktop development with C++ module from Visual Studio Installer (I unchecked all the optional submodules, so I installed only the C++ core desktop features)
Try setting VS170COMNTOOLS to C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools Even thought Visual Studio 2022 is now 64 bit the build tools seem to be installed in the x86 program files folder.
I don't have any Visual Studio 2022 folder under Program Files (x86), the build tools are in the x64 in my case
Solved: I had to install the MSVC module under Desktop development with C++ in Visual Studio Installer
In the visual studio installer app try selecting the same options as in the screenshot at the top of this thread.
I just experienced this on Unity 2021.3.8f1 LTS, shouldn't this be handled by Unity or at least give us concise instructions on how to fix the error via the VS Installer? @bitter -edit- Ok, I see that clicking on one (an only this one) of the several lines of errors, I get more information on what exactly has to be installed on VS: Installing the win10 SDK from the Visual Studio installer fixed the compilation issues. Maybe this information could be stated more clearly as a notification window when you try to build for IL2CPP and it's missing something.
I have similar issue trying Unity 2021.3.12f, Windows 11 on ARM and Visual Studio 2022. I know ARM isn't supported but both Unity and VS just works. Only building with IL2CPP causing troubles. I have installed Desktop development with C++ (including Windows 10 SDK) and Game development with Unity work flows. I have tried to set ENV VSCOMNTOOLS, VS160COMNTOOLS and VS170COMNTOOLS as C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools. I've checked regedit path SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder it exists. I was also tried VS2019 nothing helps, I'm still getting error: Internal build system error. BuildProgram exited with code -2146233088. error: Could not set up a toolchain for Architecture x64. Make sure you have the right build tools installed for il2cpp builds. Details: IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed: * Visual Studio 2022 or newer with C++ compilers and Windows 10 SDK (recommended) * Visual Studio 2019 with C++ compilers and Windows 10 SDK * Visual Studio 2017 with C++ compilers and Windows 10 SDK * Visual Studio 2015 with C++ compilers and Windows 10 SDK Visual Studio 2017 (or newer) is detected using `vswhere.exe` as well as VSCOMNTOOLS environment variables. Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry as well as VSCOMNTOOLS environment variables. Windows 10 SDK is detected by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry. Unable to detect any compatible Visual Studio installation! * Found Visual Studio 2022 installation without support for architecture x64 Unity.IL2CPP.Bee.BuildLogic.ToolchainNotFoundException: IL2CPP C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed: * Visual Studio 2022 or newer with C++ compilers and Windows 10 SDK (recommended) * Visual Studio 2019 with C++ compilers and Windows 10 SDK * Visual Studio 2017 with C++ compilers and Windows 10 SDK * Visual Studio 2015 with C++ compilers and Windows 10 SDK Visual Studio 2017 (or newer) is detected using `vswhere.exe` as well as VSCOMNTOOLS environment variables. Visual Studio 2015 is detected by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry as well as VSCOMNTOOLS environment variables. Windows 10 SDK is detected by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry. Unable to detect any compatible Visual Studio installation! * Found Visual Studio 2022 installation without support for architecture x64 at Unity.IL2CPP.Bee.BuildLogic.WindowsDesktop.WindowsDesktopBuildLogic.UserAvailableToolchainFor(Architecture architecture, NPath toolChainPath, NPath sysRootPath) at PlayerBuildProgramLibrary.PlayerBuildProgramBase.GetIl2CppToolChain(PlatformBuildLogic platform, Architecture architecture, NPath toolChainPath, NPath sysrootPath) at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupIl2CppBuild() at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupPlayerBuild() at WinPlayerBuildProgram.WinPlayerBuildProgram.SetupPlayerBuild() at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram() at PlayerBuildProgramTypeWrapper.Run(String[] args) at Program.Main(String[] args) UnityEngine.GUIUtilityrocessEvent (int,intptr,bool&) here is the output of vswhere Visual Studio Locator version 3.0.2+22c4136b72 [query version 3.3.2152.31801] Copyright (C) Microsoft Corporation. All rights reserved. instanceId: 6e89737a installDate: 11/2/2022 9:26:59 AM installationName: VisualStudio/17.3.6+32929.385 installationPath: C:\Program Files\Microsoft Visual Studio\2022\Community installationVersion: 17.3.32929.385 productId: Microsoft.VisualStudio.Product.Community productPath: C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe state: 4294967295 isComplete: 1 isLaunchable: 1 isPrerelease: 0 isRebootRequired: 0 displayName: Visual Studio Community 2022 description: Powerful IDE, free for students, open-source contributors, and individuals channelId: VisualStudio.17.Release channelUri: https://aka.ms/vs/17/release/channel enginePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service installedChannelId: VisualStudio.17.Release installedChannelUri: https://aka.ms/vs/17/release/channel releaseNotes: https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.3#17.3.6 thirdPartyNotices: https://go.microsoft.com/fwlink/?LinkId=661288 updateDate: 2022-11-02T16:26:59.7120693Z catalog_buildBranch: d17.3 catalog_buildVersion: 17.3.32929.385 catalog_id: VisualStudio/17.3.6+32929.385 catalog_localBuild: build-lab catalog_manifestName: VisualStudio catalog_manifestType: installer catalog_productDisplayVersion: 17.3.6 catalog_productLine: Dev17 catalog_productLineVersion: 2022 catalog_productMilestone: RTW catalog_productMilestoneIsPreRelease: False catalog_productName: Visual Studio catalog_productPatchVersion: 6 catalog_productPreReleaseMilestoneSuffix: 1.0 catalog_productSemanticVersion: 17.3.6+32929.385 catalog_requiredEngineVersion: 3.3.2185.63263 properties_campaignId: 2030:7760ad9e0a5e4d6aa0f4bb6d7a4242f2 properties_channelManifestId: VisualStudio.17.Release/17.3.6+32929.385 properties_nickname: properties_setupEngineFilePath: C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe
You should fill a bug report. I'm pretty sure no one expected it to run on ARM so maybe there is some magic string inside the compile process that must be changed for it to work.
I too have exactly the same problem. (Build fail for x64 on Windows11 arm) How can I submit a bug report?
I had to install additional items from the VS installer including UWP - Universal Windows Platform - from the Unity Hub, and finally the build was done.
Maybe installing the Win10 SDK alone would work? (without VS) https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/
Rider does not include C++ compiler so if you only have that installed, installing Windows SDK is not enough. However, another alternative is installing C++ build tools which take less disk space. However, Unity should be telling you what to install. If you come across any cases where Unity fails the build but doesn't tell you why, please report bugs on them. We've been trying really hard to reach a point where it points out exactly what you are missing and how to install it.
For Rider users: Download and launch Build Tools for Visual Studio from this page (scroll to the bottom, in the Visual Studio Tools section) Go to Single components Select only the latest MSVC C++ Build Tools (in my case it's "MSVC v143 - VS 2022 C++ Build Tools x64/x86") Install it and restart Unity
Hi there, I get this trouble and fixed with import Windows11SDK. Unity ver 2021.3.3f1 VisualStudio 2022 everyone import VisualStudio2019, and Windows10SDK. But I solved at my version.