Ejemplo n.º 1
0
        private static DirectoryPath GetVisualStudio2022Path(IFileSystem fileSystem, ICakeEnvironment environment,
                                                             MSBuildPlatform buildPlatform, bool allowPreviewVersion)
        {
            foreach (var edition in allowPreviewVersion
                         ? VisualStudio.Editions.All
                         : VisualStudio.Editions.Stable)
            {
                // Get the bin path.
                var binPath = VisualStudio.GetYearAndEditionRootPath(environment, "2022", edition).Combine("MSBuild/Current/Bin");
                if (fileSystem.Exist(binPath))
                {
                    if (buildPlatform == MSBuildPlatform.Automatic)
                    {
                        if (environment.Platform.Is64Bit)
                        {
                            binPath = binPath.Combine("amd64");
                        }
                    }

                    if (buildPlatform == MSBuildPlatform.x64)
                    {
                        binPath = binPath.Combine("amd64");
                    }

                    return(binPath);
                }
            }

            return(VisualStudio.GetYearAndEditionRootPath(environment, "2022", "Professional").Combine("MSBuild/Current/Bin"));
        }