Download

VS2017 RC + UE Installer on Win7 doesn't find universal CRT on compile

As it says in the title, here’s the compiler log:


LogVSAccessor:Warning: Couldn't access Visual Studio
Recompiling EntiMaps5...
Launching UnrealBuildTool... [C:/Program Files (x86)/Epic Games/4.14/Engine/Binaries/DotNET/UnrealBuildTool.exe EntiMaps5 -ModuleWithSuffix EntiMaps5 6719 Win64 Development -editorrecompile -canskiplink "C:/GitHub/EntiMaps5/EntiMaps5.uproject" ]
Warning: Starting HotReload took  0.0s.
CompilerResultsLog: New page: Compilation - Dec 18, 2016, 2:03:29 AM
CompilerResultsLog: Info Compiling game modules for hot reload
CompilerResultsLog: Info Performing 29 actions (4 in parallel)
CompilerResultsLog: Info PCH.EntiMaps5.h.cpp
CompilerResultsLog: Info C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.24728\INCLUDE\crtdefs.h(10): fatal error C1083: Datei (Include) kann nicht ge?ffnet werden: "corecrt.h": No such file or directory
CompilerResultsLog: Info ERROR: UBT ERROR: Failed to produce item: C:\GitHub\EntiMaps5\Binaries\Win64\UE4Editor-EntiMaps5-6719.dll
CompilerResultsLog: Info Total build time: 3,43 seconds
LogMainFrame: MainFrame: Module compiling took 3.602 seconds
Warning: HotReload failed, recompile failed

The folder itself exists, but it’s not the folder with the crt files.
I tried it on a complete fresh Win7 install, then installed VS2017.

  • Algorithman

Solution for the problem

If think iterating over the values in ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots’ to check if the ‘Universal CRT Headers Libraries and Sources x86’ value is present would solve it nicely.

something like




        private static string GetWindowsKitsRootPath(string registryPath)
        {
            Dictionary<string, object> keyValuePairs;
            RegistryKey mainKey;
            if (registryPath.StartsWith("HKEY_LOCAL_MACHINE\\"))
            {
                mainKey = Registry.LocalMachine;
            }
            else if (registryPath.StartsWith("HKEY_CURRENT_USER\\"))
            {
                mainKey = Registry.CurrentUser;
            }
            else
            {
                throw new NotSupportedException("Main Registrykey " + registryPath.Substring(0, registryPath.IndexOf('\\')) + " not supported.");
            }


            using (var settingsRegKey = mainKey.OpenSubKey(registryPath.Substring(registryPath.IndexOf('\\') + 1)))
            {
                if (settingsRegKey == null)
                {
                    return null;
                }
                var valueNames = settingsRegKey.GetValueNames();
                keyValuePairs = valueNames.ToDictionary(name => name, settingsRegKey.GetValue);
            }
            if (keyValuePairs.ContainsValue("Universal CRT Headers Libraries and Sources x86"))
            {
                if (keyValuePairs.ContainsKey("KitsRoot10"))
                {
                    return keyValuePairs"KitsRoot10"].ToString();
                }
            }
            return null;
        }

        /// <summary>
        /// Finds the directory containing the Universal CRT installation. Returns null for Visual Studio versions before 2015
        /// </summary>
        static string FindUniversalCRTInstallationFolder()
		{
			if (WindowsPlatform.Compiler < WindowsCompiler.VisualStudio2015)
			{
				return null;
			}

            object Value = GetWindowsKitsRootPath("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots") ??
                GetWindowsKitsRootPath("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots") ??
                GetWindowsKitsRootPath("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Kits\\Installed Roots") ??
                GetWindowsKitsRootPath("HKEY_CURRENT_USER\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Kits\\Installed Roots");
            	return (Value as string);
		}
}