- Home /
Error while building for Windows,I can't build games for Windows in Unity.
Hi,
I'm running into the following error message when trying to build games.
I use Windows 10 Enterprise 20H2 19042.685. I've looked through the forums but I could only find fixes for android. I have updated my current editor (Visual Studio 2019) to the latest version (16.8.3)
This is the error I've been getting.
Exception: D:\Unity\2019.4.16f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe did not run properly!
Failed running "D:\Unity\2019.4.16f1\Editor\Data\il2cpp/build/deploy/net471/il2cpp.exe" --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="WindowsDesktop" --architecture="x86" --configuration="Release" --outputpath="D:\Unity\Projects\Chess test 2\Temp/StagingArea/Data\Native\GameAssembly.dll" --cachedirectory="D:\Unity\Projects\Chess test 2\Assets\..\Library/il2cpp_cache" --profiler-report --map-file-parser=D:/Unity/2019.4.16f1/Editor/Data/Tools/MapFileParser/MapFileParser.exe --directory="D:/Unity/Projects/Chess test 2/Temp/StagingArea/Data/Managed" --generatedcppdir="D:/Unity/Projects/Chess test 2/Temp/StagingArea/Data/il2cppOutput"
stdout:
il2cpp.exe didn't catch exception: System.InvalidOperationException: 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 2015 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed or missing C++ workload component)
Visual Studio 2015 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry
Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
Visual Studio 2017 (or newer) with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed or missing C++ workload component)
Visual Studio 2017 (or newer) installation is found using Microsoft.VisualStudio.Setup.Configuration COM APIs
Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
at Unity.IL2CPP.Building.CppProgramBuilder.ThrowIfCannotBuildInCurrentEnvironment()
at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
at il2cpp.Program.DoRun(String[] args, List`1 foundAssemblies)
at il2cpp.Program.Run(String[] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[] args)
stderr:
Unhandled Exception: System.InvalidOperationException: 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 2015 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed or missing C++ workload component)
Visual Studio 2015 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry
Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
Visual Studio 2017 (or newer) with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed or missing C++ workload component)
Visual Studio 2017 (or newer) installation is found using Microsoft.VisualStudio.Setup.Configuration COM APIs
Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
at Unity.IL2CPP.Building.CppProgramBuilder.ThrowIfCannotBuildInCurrentEnvironment()
at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics)
at il2cpp.Program.DoRun(String[] args, List`1 foundAssemblies)
at il2cpp.Program.Run(String[] args, Boolean setInvariantCulture)
at il2cpp.Program.Main(String[] args)
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo, System.String workingDirectory) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.String workingDirectory, System.Boolean platformSupportsManagedDebugging) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditorInternal.IL2CPPBuilder.Run () (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <7d90b28560b644ce87b8263efcc36eed>:0)
DesktopStandalonePostProcessor.SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs args, System.Collections.Generic.HashSet`1[T] filesToNotOverwrite) (at <7d90b28560b644ce87b8263efcc36eed>:0)
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <7d90b28560b644ce87b8263efcc36eed>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
Answer by Zaeran · Dec 18, 2020 at 06:36 PM
It sounds like toying to do an IL2CPP build, but your visual studio installation doesn't have the C++ compiler modules installed.
By default, the VS that comes with Unity only has C# IIRC
This video goes over the process of how to install C++ libraries into VS2019
I can't believe that actually worked.
I have been struggling with this issue for over the past week. Thank you!
THANK YOU SOOOO MUCH!!!! I almost gave up on my project and gonna fail my subject. I've beening looking for the solution and only found for Android too. Thank you so much, thank you...
Follow this Question
Related Questions
Game not working after build 0 Answers
How to fix Unity compiler error when building WP8.1 game? 2 Answers
Builded Game Stopped working 2 Answers
errors on IL2CPP build 0 Answers
Gradle build error 0 Answers