Fixing Error Failed to Locate ''CL.exe'' or MSB8020 When Deploying IL2CPP Solution
Here's how to fix a ''failed-to-locate'' error when deploying your IL2CPP solution.
Join the DZone community and get the full member experience.
Join For FreeSymptom
You have created a Unity project to create an app using MRTK2, and you want to use the new IL2CPP back-end. You open the solution in Visual Studio 2019, you try to deploy it by using Build/Deploy, and all the way at the end, the compiler complains about the "CL.exe" missing.
Alternatively, you might get the slightly more verbose error:
"error MSB8020: The build tools for Visual Studio 2017 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install Visual Studio 2017 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution"."
Cause
You have most likely used the recommended Unity version (2018.4.2f1) to create the project. This version — the name gives it away — was released before Visual Studio 2019, and therefore, it assumes the presence of Visual Studio 2017 and it's accompanying C++ tools set, 'V141'. So, Unity generated a C++ solution referencing that toolset.
But now it's 2019, you have kissed Visual Studio 2017 goodbye and installed Visual Studio 2019. And that comes with the toolset V142.
Solution
Either you install V141 using the Visual Studio Installer, or you tell the generated solution to use V142. I personally prefer the last one, because newer is always better, right?
Simply right-click the project in the solution that has "(Universal Windows)" behind its name, select properties, tab general, and then the problem is already pretty evident:
Simply select Visual Studio 2019 (142) for the Project Toolset and you are good to go. This setting will stay as long as you don't delete the generated project — Unity will simply change what needs to be changed, and leave as much as it can (to speed up the generation process).
Conclusion
While this was a simple fix, it can be hard to find. Hence, a simple blog about it.
Hope you learned something!
Published at DZone with permission of Joost van Schaik, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments