liamkf / Unreal_FASTBuild

Allows UnrealEngine to be built with FASTBuild for VS2015/VS2017 and Windows 10.
MIT License
180 stars 71 forks source link

is there a way to detect VC redist version? #32

Open RPG3D opened 5 years ago

RPG3D commented 5 years ago

I want to avoid using a fixed version string in code such as : AddText(string.Format("\t\t'{0}/Redist/MSVC/14.16.27012/x64/Microsoft.VC141.CRT/msvcp{1}.dll'\n", @"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC", platformVersionNumber)); the redist version is diffirent from ToolChainVersion.

ricekab commented 5 years ago

The easiest way would probably to use a base path from some registry value and then search relative to that location. May not work for all situations but it's what UnrealEngine does internally as well. I'd recommend just taking a look at UnrealBuildTool/Platform/Windows/VCEnvironment.cs in UnrealEngine for reference.

I do the same thing here: https://gist.github.com/RiceKab/60d7dd434afaab295d1c21d2fe1981b0#file-vcenvironmentfastbuildextensions-cs

msolemajor commented 5 years ago

Ugly has hell but works fine :)

            string RedistFilePath = string.Format("{0}/VC/Auxiliary/Build/Microsoft.VCRedistVersion.default.txt", VCInstallDir);
            string RedistVersionNumber = System.IO.File.ReadAllText(RedistFilePath).TrimEnd('\r', '\n');