Ejemplo n.º 1
0
        public static string GetVisualStudioDir(this DevEnv visualVersion, bool ignoreVisualStudioPathOverride = false)
        {
            // TODO: Replace Tuple with ValueTuple once we support C# 8 because ValueTuple is
            //       allocated on the stack. That should be faster here.
            string visualStudioDirectory = s_visualStudioDirectories.GetOrAdd(Tuple.Create(visualVersion, ignoreVisualStudioPathOverride), devEnv =>
            {
                // First check if the visual studio path is overriden from default value.
                string pathOverride;
                if (s_visualStudioDirOverrides.TryGetValue(visualVersion, out pathOverride))
                {
                    return(pathOverride);
                }

                string installDir = Util.GetVisualStudioInstallPathFromQuery(visualVersion);
                if (string.IsNullOrEmpty(installDir))
                {
                    switch (visualVersion)
                    {
                    case DevEnv.vs2017:
                    case DevEnv.vs2019:
                        installDir = @"Microsoft Visual Studio\" + GetVSYear(visualVersion) + @"\Professional";
                        break;

                    default:
                        installDir = string.Format(@"Microsoft Visual Studio {0}", visualVersion.GetVisualVersionString());
                        break;
                    }
                    installDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), installDir);
                }
                return(Util.SimplifyPath(installDir));
            });

            return(visualStudioDirectory);
        }
Ejemplo n.º 2
0
        public static string GetVisualStudioDir(this DevEnv visualVersion)
        {
            string registryKeyString = string.Format(
                @"SOFTWARE{0}\Microsoft\VisualStudio\SxS\VS7",
                Environment.Is64BitProcess ? @"\Wow6432Node" : string.Empty);

            string fallback = visualVersion == DevEnv.vs2017 ? @"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional"
                                                             : @"C:\Program Files (x86)\Microsoft Visual Studio " + visualVersion.GetVisualVersionString();

            string installDir = Util.GetRegistryLocalMachineSubKeyValue(registryKeyString, visualVersion.GetVisualVersionString(), fallback);

            return(Util.SimplifyPath(installDir));
        }
Ejemplo n.º 3
0
        public static string GetVisualStudioDir(this DevEnv visualVersion, bool ignoreVisualStudioPathOverride = false)
        {
            if (!visualVersion.IsVisualStudio())
            {
                throw new Error($"{visualVersion} is not a visual studio version!");
            }

            // TODO: Replace Tuple with ValueTuple once we support C# 8 because ValueTuple is
            //       allocated on the stack. That should be faster here.
            string visualStudioDirectory = s_visualStudioDirectories.GetOrAdd(Tuple.Create(visualVersion, ignoreVisualStudioPathOverride), devEnv =>
            {
                if (!ignoreVisualStudioPathOverride)
                {
                    // First check if the visual studio path is overridden from default value.
                    string pathOverride;
                    if (s_visualStudioDirOverrides.TryGetValue(visualVersion, out pathOverride))
                    {
                        return(pathOverride);
                    }
                }

                string installDir = Util.GetVisualStudioInstallPathFromQuery(visualVersion);
                if (string.IsNullOrEmpty(installDir))
                {
                    // try again but this time including previews
                    installDir = Util.GetVisualStudioInstallPathFromQuery(visualVersion, allowPrereleaseVersions: true);
                    if (string.IsNullOrEmpty(installDir)) // arbitrary fallback
                    {
                        if (visualVersion > DevEnv.vs2015)
                        {
                            installDir = @"Microsoft Visual Studio\" + GetVSYear(visualVersion) + @"\Professional";
                        }
                        else
                        {
                            installDir = string.Format(@"Microsoft Visual Studio {0}", visualVersion.GetVisualVersionString());
                        }
                        string rootDir = Environment.GetFolderPath(visualVersion < DevEnv.vs2022 ? Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles);
                        installDir     = Path.Combine(rootDir, installDir);
                    }
                }
                return(Util.SimplifyPath(installDir));
            });

            return(visualStudioDirectory);
        }
Ejemplo n.º 4
0
        public static string GetVisualStudioDir(this DevEnv visualVersion)
        {
            // First check if the visual studio path is overriden from default value.
            string pathOverride;

            if (s_visualStudioDirOverrides.TryGetValue(visualVersion, out pathOverride))
            {
                return(pathOverride);
            }

            string registryKeyString = string.Format(
                @"SOFTWARE{0}\Microsoft\VisualStudio\SxS\VS7",
                Environment.Is64BitProcess ? @"\Wow6432Node" : string.Empty);

            string fallback = visualVersion == DevEnv.vs2017 ? @"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional"
                                                             : @"C:\Program Files (x86)\Microsoft Visual Studio " + visualVersion.GetVisualVersionString();

            string installDir = Util.GetRegistryLocalMachineSubKeyValue(registryKeyString, visualVersion.GetVisualVersionString(), fallback);

            return(Util.SimplifyPath(installDir));
        }
Ejemplo n.º 5
0
        public static string GetConvertedRelativePath(
            string absolutePath,
            string relativePath,
            string newRelativeToFullPath,
            bool ignoreCase,
            string rootPath = null
            )
        {
            string tmpAbsolute     = PathGetAbsolute(absolutePath, relativePath);
            string newRelativePath = PathGetRelative(newRelativeToFullPath, tmpAbsolute, ignoreCase);

            if (rootPath != null)
            {
                string cleanPath = Util.SimplifyPath(rootPath);
                if (!tmpAbsolute.StartsWith(cleanPath, StringComparison.OrdinalIgnoreCase))
                {
                    return(tmpAbsolute);
                }
            }

            return(newRelativePath);
        }
Ejemplo n.º 6
0
            public CompilerSettings GetMasterCompilerSettings(
                IDictionary <string, CompilerSettings> masterCompilerSettings,
                string compilerName,
                DevEnv devEnv,
                string projectRootPath,
                Options.Vc.General.PlatformToolset platformToolset,
                bool useCCompiler
                )
            {
                CompilerSettings compilerSettings;

                if (masterCompilerSettings.ContainsKey(compilerName))
                {
                    compilerSettings = masterCompilerSettings[compilerName];
                }
                else
                {
                    DevEnv?compilerDevEnv      = null;
                    string platformToolSetPath = null;
                    string pathToCompiler      = null;
                    string compilerExeName     = null;
                    var    compilerFamily      = Sharpmake.CompilerFamily.Auto;
                    var    fastBuildSettings   = PlatformRegistry.Get <IFastBuildCompilerSettings>(Platform.win64);

                    switch (platformToolset)
                    {
                    case Options.Vc.General.PlatformToolset.Default:
                        compilerDevEnv = devEnv;
                        break;

                    case Options.Vc.General.PlatformToolset.v100:
                        compilerDevEnv = DevEnv.vs2010;
                        break;

                    case Options.Vc.General.PlatformToolset.v110:
                    case Options.Vc.General.PlatformToolset.v110_xp:
                        compilerDevEnv = DevEnv.vs2012;
                        break;

                    case Options.Vc.General.PlatformToolset.v120:
                    case Options.Vc.General.PlatformToolset.v120_xp:
                        compilerDevEnv = DevEnv.vs2013;
                        break;

                    case Options.Vc.General.PlatformToolset.v140:
                    case Options.Vc.General.PlatformToolset.v140_xp:
                        compilerDevEnv = DevEnv.vs2015;
                        break;

                    case Options.Vc.General.PlatformToolset.v141:
                    case Options.Vc.General.PlatformToolset.v141_xp:
                        compilerDevEnv = DevEnv.vs2017;
                        break;

                    case Options.Vc.General.PlatformToolset.v142:
                        compilerDevEnv = DevEnv.vs2019;
                        break;

                    case Options.Vc.General.PlatformToolset.LLVM_vs2012:
                    case Options.Vc.General.PlatformToolset.LLVM_vs2014:
                    case Options.Vc.General.PlatformToolset.LLVM:

                        platformToolSetPath = ClangForWindows.Settings.LLVMInstallDir;
                        pathToCompiler      = Path.Combine(platformToolSetPath, "bin");
                        compilerExeName     = "clang-cl.exe";

                        var compilerFamilyKey = new FastBuildWindowsCompilerFamilyKey(devEnv, platformToolset);
                        if (!fastBuildSettings.CompilerFamily.TryGetValue(compilerFamilyKey, out compilerFamily))
                        {
                            compilerFamily = Sharpmake.CompilerFamily.ClangCl;
                        }

                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }

                    if (compilerDevEnv.HasValue)
                    {
                        platformToolSetPath = Path.Combine(compilerDevEnv.Value.GetVisualStudioDir(), "VC");
                        pathToCompiler      = compilerDevEnv.Value.GetVisualStudioBinPath(Platform.win64);
                        compilerExeName     = "cl.exe";

                        var compilerFamilyKey = new FastBuildWindowsCompilerFamilyKey(devEnv, platformToolset);
                        if (!fastBuildSettings.CompilerFamily.TryGetValue(compilerFamilyKey, out compilerFamily))
                        {
                            compilerFamily = Sharpmake.CompilerFamily.MSVC;
                        }
                    }

                    Strings extraFiles = new Strings();
                    {
                        Strings userExtraFiles;
                        if (fastBuildSettings.ExtraFiles.TryGetValue(devEnv, out userExtraFiles))
                        {
                            extraFiles.AddRange(userExtraFiles);
                        }
                    }

                    if (compilerDevEnv.HasValue)
                    {
                        extraFiles.Add(
                            @"$ExecutableRootPath$\c1.dll",
                            @"$ExecutableRootPath$\c1xx.dll",
                            @"$ExecutableRootPath$\c2.dll",
                            @"$ExecutableRootPath$\mspdbcore.dll",
                            @"$ExecutableRootPath$\mspdbsrv.exe",
                            @"$ExecutableRootPath$\1033\clui.dll"
                            );

                        switch (devEnv)
                        {
                        case DevEnv.vs2012:
                        {
                            extraFiles.Add(
                                @"$ExecutableRootPath$\c1ast.dll",
                                @"$ExecutableRootPath$\c1xxast.dll",
                                @"$ExecutableRootPath$\mspft110.dll",
                                @"$ExecutableRootPath$\msobj110.dll",
                                @"$ExecutableRootPath$\mspdb110.dll",
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC110.CRT\msvcp110.dll"),
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC110.CRT\msvcr110.dll"),
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC110.CRT\vccorlib110.dll")
                                );
                        }
                        break;

                        case DevEnv.vs2013:
                        {
                            extraFiles.Add(
                                @"$ExecutableRootPath$\c1ast.dll",
                                @"$ExecutableRootPath$\c1xxast.dll",
                                @"$ExecutableRootPath$\mspft120.dll",
                                @"$ExecutableRootPath$\msobj120.dll",
                                @"$ExecutableRootPath$\mspdb120.dll",
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC120.CRT\msvcp120.dll"),
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC120.CRT\msvcr120.dll"),
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC120.CRT\vccorlib120.dll")
                                );
                        }
                        break;

                        case DevEnv.vs2015:
                        case DevEnv.vs2017:
                        case DevEnv.vs2019:
                        {
                            string systemDllPath = FastBuildSettings.SystemDllRoot;
                            if (systemDllPath == null)
                            {
                                var    windowsTargetPlatformVersion = KitsRootPaths.GetWindowsTargetPlatformVersionForDevEnv(devEnv);
                                string redistDirectory;
                                if (windowsTargetPlatformVersion <= Options.Vc.General.WindowsTargetPlatformVersion.v10_0_17134_0)
                                {
                                    redistDirectory = @"Redist\ucrt\DLLs\x64\";
                                }
                                else
                                {
                                    redistDirectory = $@"Redist\{windowsTargetPlatformVersion.ToVersionString()}\ucrt\DLLs\x64\";
                                }

                                systemDllPath = Path.Combine(KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot10), redistDirectory);
                            }

                            if (!Path.IsPathRooted(systemDllPath))
                            {
                                systemDllPath = Util.SimplifyPath(Path.Combine(projectRootPath, systemDllPath));
                            }

                            extraFiles.Add(
                                @"$ExecutableRootPath$\msobj140.dll",
                                @"$ExecutableRootPath$\mspft140.dll",
                                @"$ExecutableRootPath$\mspdb140.dll"
                                );

                            if (devEnv == DevEnv.vs2015)
                            {
                                extraFiles.Add(
                                    @"$ExecutableRootPath$\vcvars64.bat",
                                    Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC140.CRT\concrt140.dll"),
                                    Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC140.CRT\msvcp140.dll"),
                                    Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC140.CRT\vccorlib140.dll"),
                                    Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC140.CRT\vcruntime140.dll"),
                                    Path.Combine(systemDllPath, "ucrtbase.dll")
                                    );
                            }
                            else
                            {
                                extraFiles.Add(
                                    @"$ExecutableRootPath$\mspdbcore.dll",
                                    @"$ExecutableRootPath$\msvcdis140.dll",
                                    @"$ExecutableRootPath$\msvcp140.dll",
                                    @"$ExecutableRootPath$\pgodb140.dll",
                                    @"$ExecutableRootPath$\vcruntime140.dll",
                                    Path.Combine(platformToolSetPath, @"Auxiliary\Build\vcvars64.bat")
                                    );
                            }

                            if (devEnv == DevEnv.vs2019)
                            {
                                Version toolsVersion = devEnv.GetVisualStudioVCToolsVersion();

                                if (toolsVersion >= new Version("14.22.27905"))
                                {
                                    extraFiles.Add(@"$ExecutableRootPath$\tbbmalloc.dll");
                                }

                                if (toolsVersion >= new Version("14.25.28610"))
                                {
                                    extraFiles.Add(@"$ExecutableRootPath$\vcruntime140_1.dll");
                                }
                            }

                            try
                            {
                                foreach (string p in Util.DirectoryGetFiles(systemDllPath, "api-ms-win-*.dll"))
                                {
                                    extraFiles.Add(p);
                                }
                            }
                            catch { }
                        }
                        break;

                        default:
                            throw new NotImplementedException("This devEnv (" + devEnv + ") is not supported!");
                        }
                    }

                    string executable = Path.Combine("$ExecutableRootPath$", compilerExeName);

                    compilerSettings = new CompilerSettings(compilerName, compilerFamily, Platform.win64, extraFiles, executable, pathToCompiler, devEnv, new Dictionary <string, CompilerSettings.Configuration>());
                    masterCompilerSettings.Add(compilerName, compilerSettings);
                }

                return(compilerSettings);
            }
Ejemplo n.º 7
0
            public CompilerSettings GetMasterCompilerSettings(
                IDictionary <string, CompilerSettings> masterCompilerSettings,
                string compilerName,
                DevEnv devEnv,
                string projectRootPath,
                Options.Vc.General.PlatformToolset platformToolset,
                bool useCCompiler
                )
            {
                CompilerSettings compilerSettings;

                if (masterCompilerSettings.ContainsKey(compilerName))
                {
                    compilerSettings = masterCompilerSettings[compilerName];
                }
                else
                {
                    DevEnv?compilerDevEnv      = null;
                    string platformToolSetPath = null;
                    string pathToCompiler      = null;
                    string compilerExeName     = null;

                    switch (platformToolset)
                    {
                    case Options.Vc.General.PlatformToolset.Default:
                        compilerDevEnv = devEnv;
                        break;

                    case Options.Vc.General.PlatformToolset.v100:
                        compilerDevEnv = DevEnv.vs2010;
                        break;

                    case Options.Vc.General.PlatformToolset.v110:
                    case Options.Vc.General.PlatformToolset.v110_xp:
                        compilerDevEnv = DevEnv.vs2012;
                        break;

                    case Options.Vc.General.PlatformToolset.v120:
                    case Options.Vc.General.PlatformToolset.v120_xp:
                        compilerDevEnv = DevEnv.vs2013;
                        break;

                    case Options.Vc.General.PlatformToolset.v140:
                    case Options.Vc.General.PlatformToolset.v140_xp:
                        compilerDevEnv = DevEnv.vs2015;
                        break;

                    case Options.Vc.General.PlatformToolset.v141:
                    case Options.Vc.General.PlatformToolset.v141_xp:
                        compilerDevEnv = DevEnv.vs2017;
                        break;

                    case Options.Vc.General.PlatformToolset.LLVM_vs2012:
                    case Options.Vc.General.PlatformToolset.LLVM_vs2014:
                    case Options.Vc.General.PlatformToolset.LLVM:

                        platformToolSetPath = ClangForWindows.Settings.LLVMInstallDir;
                        pathToCompiler      = Path.Combine(platformToolSetPath, "bin");
                        compilerExeName     = "clang-cl.exe";

                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }

                    if (compilerDevEnv.HasValue)
                    {
                        platformToolSetPath = Path.Combine(compilerDevEnv.Value.GetVisualStudioDir(), "VC");
                        pathToCompiler      = compilerDevEnv.Value.GetVisualStudioBinPath(Platform.win64);
                        compilerExeName     = "cl.exe";
                    }

                    Strings extraFiles = new Strings();
                    if (compilerDevEnv.HasValue)
                    {
                        extraFiles.Add(
                            @"$ExecutableRootPath$\c1.dll",
                            @"$ExecutableRootPath$\c1xx.dll",
                            @"$ExecutableRootPath$\c2.dll",
                            @"$ExecutableRootPath$\mspdbcore.dll",
                            @"$ExecutableRootPath$\mspdbsrv.exe",
                            @"$ExecutableRootPath$\1033\clui.dll"
                            );

                        switch (devEnv)
                        {
                        case DevEnv.vs2012:
                        {
                            extraFiles.Add(
                                @"$ExecutableRootPath$\c1ast.dll",
                                @"$ExecutableRootPath$\c1xxast.dll",
                                @"$ExecutableRootPath$\mspft110.dll",
                                @"$ExecutableRootPath$\msobj110.dll",
                                @"$ExecutableRootPath$\mspdb110.dll",
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC110.CRT\msvcp110.dll"),
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC110.CRT\msvcr110.dll"),
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC110.CRT\vccorlib110.dll")
                                );
                        }
                        break;

                        case DevEnv.vs2013:
                        {
                            extraFiles.Add(
                                @"$ExecutableRootPath$\c1ast.dll",
                                @"$ExecutableRootPath$\c1xxast.dll",
                                @"$ExecutableRootPath$\mspft120.dll",
                                @"$ExecutableRootPath$\msobj120.dll",
                                @"$ExecutableRootPath$\mspdb120.dll",
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC120.CRT\msvcp120.dll"),
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC120.CRT\msvcr120.dll"),
                                Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC120.CRT\vccorlib120.dll")
                                );
                        }
                        break;

                        case DevEnv.vs2015:
                        case DevEnv.vs2017:
                        {
                            string systemDllPath = FastBuildSettings.SystemDllRoot;
                            if (systemDllPath == null)
                            {
                                systemDllPath = KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot10) + @"Redist\ucrt\DLLs\x64\";
                            }

                            if (!Path.IsPathRooted(systemDllPath))
                            {
                                systemDllPath = Util.SimplifyPath(Path.Combine(projectRootPath, systemDllPath));
                            }

                            extraFiles.Add(
                                @"$ExecutableRootPath$\msobj140.dll",
                                @"$ExecutableRootPath$\mspft140.dll",
                                @"$ExecutableRootPath$\mspdb140.dll"
                                );

                            if (devEnv == DevEnv.vs2015)
                            {
                                extraFiles.Add(
                                    @"$ExecutableRootPath$\vcvars64.bat",
                                    Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC140.CRT\concrt140.dll"),
                                    Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC140.CRT\msvcp140.dll"),
                                    Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC140.CRT\vccorlib140.dll"),
                                    Path.Combine(platformToolSetPath, @"redist\x64\Microsoft.VC140.CRT\vcruntime140.dll"),
                                    Path.Combine(systemDllPath, "ucrtbase.dll")
                                    );
                            }
                            else
                            {
                                extraFiles.Add(
                                    @"$ExecutableRootPath$\mspdbcore.dll",
                                    @"$ExecutableRootPath$\msvcdis140.dll",
                                    @"$ExecutableRootPath$\msvcp140.dll",
                                    @"$ExecutableRootPath$\pgodb140.dll",
                                    @"$ExecutableRootPath$\vcruntime140.dll",
                                    Path.Combine(platformToolSetPath, @"Auxiliary\Build\vcvars64.bat")
                                    );
                            }

                            try
                            {
                                foreach (string p in Util.DirectoryGetFiles(systemDllPath, "api-ms-win-*.dll"))
                                {
                                    extraFiles.Add(p);
                                }
                            }
                            catch { }
                        }
                        break;

                        default:
                            throw new NotImplementedException("This devEnv (" + devEnv + ") is not supported!");
                        }
                    }

                    string executable = Path.Combine("$ExecutableRootPath$", compilerExeName);

                    compilerSettings = new CompilerSettings(compilerName, Platform.win64, extraFiles, executable, pathToCompiler, devEnv, new Dictionary <string, CompilerSettings.Configuration>());
                    masterCompilerSettings.Add(compilerName, compilerSettings);
                }

                return(compilerSettings);
            }
Ejemplo n.º 8
0
            public override CompilerSettings GetMasterCompilerSettings(
                IDictionary <string, CompilerSettings> masterCompilerSettings,
                string compilerName,
                string rootPath,
                DevEnv devEnv,
                string projectRootPath,
                bool useCCompiler
                )
            {
                CompilerSettings compilerSettings;

                if (masterCompilerSettings.ContainsKey(compilerName))
                {
                    compilerSettings = masterCompilerSettings[compilerName];
                }
                else
                {
                    string pathToCompiler = devEnv.GetVisualStudioBinPath(Platform.win64);
                    if (pathToCompiler.StartsWith(rootPath, StringComparison.OrdinalIgnoreCase))
                    {
                        string rootRelative = pathToCompiler.Substring(rootPath.Length).TrimStart(Util._pathSeparators);
                        pathToCompiler = Path.Combine("$RootPath$", rootRelative);
                    }

                    Strings extraFiles = new Strings();

                    extraFiles.Add(
                        Path.Combine(pathToCompiler, "c1.dll"),
                        Path.Combine(pathToCompiler, "c1xx.dll"),
                        Path.Combine(pathToCompiler, "c2.dll"),
                        Path.Combine(pathToCompiler, "mspdbcore.dll"),
                        Path.Combine(pathToCompiler, "mspdbsrv.exe"),
                        Path.Combine(pathToCompiler, @"1033\clui.dll")
                        );

                    switch (devEnv)
                    {
                    case DevEnv.vs2012:
                    {
                        extraFiles.Add(
                            Path.Combine(pathToCompiler, "c1ast.dll"),
                            Path.Combine(pathToCompiler, "c1xxast.dll"),
                            Path.Combine(pathToCompiler, "mspft110.dll"),
                            Path.Combine(pathToCompiler, "msobj110.dll"),
                            Path.Combine(pathToCompiler, "mspdb110.dll"),
                            @"$RootPath$\redist\x64\Microsoft.VC110.CRT\msvcp110.dll",
                            @"$RootPath$\redist\x64\Microsoft.VC110.CRT\msvcr110.dll",
                            @"$RootPath$\redist\x64\Microsoft.VC110.CRT\vccorlib110.dll"
                            );
                    }
                    break;

                    case DevEnv.vs2013:
                    {
                        extraFiles.Add(
                            Path.Combine(pathToCompiler, "c1ast.dll"),
                            Path.Combine(pathToCompiler, "c1xxast.dll"),
                            Path.Combine(pathToCompiler, "mspft120.dll"),
                            Path.Combine(pathToCompiler, "msobj120.dll"),
                            Path.Combine(pathToCompiler, "mspdb120.dll"),
                            @"$RootPath$\redist\x64\Microsoft.VC120.CRT\msvcp120.dll",
                            @"$RootPath$\redist\x64\Microsoft.VC120.CRT\msvcr120.dll",
                            @"$RootPath$\redist\x64\Microsoft.VC120.CRT\vccorlib120.dll"
                            );
                    }
                    break;

                    case DevEnv.vs2015:
                    case DevEnv.vs2017:
                    {
                        string systemDllPath = FastBuildSettings.SystemDllRoot;
                        if (systemDllPath == null)
                        {
                            systemDllPath = KitsRootPaths.GetRoot(KitsRootEnum.KitsRoot10) + @"Redist\ucrt\DLLs\x64\";
                        }

                        if (!Path.IsPathRooted(systemDllPath))
                        {
                            systemDllPath = Util.SimplifyPath(Path.Combine(projectRootPath, systemDllPath));
                        }

                        extraFiles.Add(
                            Path.Combine(pathToCompiler, "msobj140.dll"),
                            Path.Combine(pathToCompiler, "mspft140.dll"),
                            Path.Combine(pathToCompiler, "mspdb140.dll")
                            );

                        if (devEnv == DevEnv.vs2015)
                        {
                            extraFiles.Add(

                                Path.Combine(pathToCompiler, "vcvars64.bat"),
                                @"$RootPath$\redist\x64\Microsoft.VC140.CRT\concrt140.dll",
                                @"$RootPath$\redist\x64\Microsoft.VC140.CRT\msvcp140.dll",
                                @"$RootPath$\redist\x64\Microsoft.VC140.CRT\vccorlib140.dll",
                                @"$RootPath$\redist\x64\Microsoft.VC140.CRT\vcruntime140.dll",
                                Path.Combine(systemDllPath, "ucrtbase.dll")
                                );
                        }
                        else
                        {
                            extraFiles.Add(
                                Path.Combine(pathToCompiler, "mspdbcore.dll"),
                                Path.Combine(pathToCompiler, "msvcdis140.dll"),
                                Path.Combine(pathToCompiler, "msvcp140.dll"),
                                Path.Combine(pathToCompiler, "pgodb140.dll"),
                                Path.Combine(pathToCompiler, "vcruntime140.dll"),
                                @"$RootPath$\Auxiliary\Build\vcvars64.bat"
                                );
                        }

                        try
                        {
                            foreach (string p in Util.DirectoryGetFiles(systemDllPath, "api-ms-win-*.dll"))
                            {
                                extraFiles.Add(p);
                            }
                        }
                        catch { }
                    }
                    break;

                    default:
                        throw new NotImplementedException("This devEnv (" + devEnv + ") is not supported!");
                    }

                    string executable = Path.Combine(pathToCompiler, "cl.exe");

                    compilerSettings = new CompilerSettings(compilerName, Platform.win64, extraFiles, executable, rootPath, devEnv, new Dictionary <string, CompilerSettings.Configuration>());
                    masterCompilerSettings.Add(compilerName, compilerSettings);
                }

                return(compilerSettings);
            }