private FilePath GetYearAndEditionToolPath(string yearAndEdition) { var programFiles = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); var root = programFiles.Combine(string.Concat("Microsoft Visual Studio/", yearAndEdition, "/Common7/IDE/CommonExtensions/Microsoft/TestWindow")); return(root.CombineWithFilePath(VSTestConsoleExecutableName)); }
private FilePath GetFromDisc(string toolExecutable) { // Get the path to program files. var programFilesX86 = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); var programFiles64Bit = _environment.GetSpecialPath(SpecialPath.ProgramFiles); // Gets a list of the files we should check. var files = new List <FilePath> { // 64-bit programFiles64Bit.Combine(@"Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools").CombineWithFilePath(toolExecutable), programFiles64Bit.Combine(@"Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools").CombineWithFilePath(toolExecutable), programFiles64Bit.Combine(@"Windows Kits\8.1\bin\x64").CombineWithFilePath(toolExecutable), programFiles64Bit.Combine(@"Windows Kits\8.0\bin\x64").CombineWithFilePath(toolExecutable), programFiles64Bit.Combine(@"Microsoft SDKs\Windows\v7.1A\Bin").CombineWithFilePath(toolExecutable), // x86 programFilesX86.Combine(@"Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools").CombineWithFilePath(toolExecutable), programFilesX86.Combine(@"Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools").CombineWithFilePath(toolExecutable), programFilesX86.Combine(@"Windows Kits\8.1\bin\x86").CombineWithFilePath(toolExecutable), programFilesX86.Combine(@"Windows Kits\8.0\bin\x86").CombineWithFilePath(toolExecutable), programFilesX86.Combine(@"Microsoft SDKs\Windows\v7.1A\Bin").CombineWithFilePath(toolExecutable) }; // Return the first path that exist. return(files.FirstOrDefault(file => _fileSystem.Exist(file))); }
private FilePath GetVersionNumberToolPath(string version) { var programFiles = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); var root = programFiles.Combine(string.Concat("Microsoft Visual Studio ", version, "/Common7/IDE")); return(root.CombineWithFilePath("mstest.exe")); }
private FilePath GetFromDisc() { // Get the path to program files. var programFilesPath = _environment.Platform.Is64Bit ? _environment.GetSpecialPath(SpecialPath.ProgramFilesX86) : _environment.GetSpecialPath(SpecialPath.ProgramFiles); // Gets a list of the files we should check. var files = new List <FilePath>(); if (_environment.Platform.Is64Bit) { // 64-bit specific paths. files.Add(programFilesPath.Combine(@"Windows Kits\10\bin\x64").CombineWithFilePath("signtool.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\10\bin\10.0.15063.0\x64").CombineWithFilePath("signtool.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\10\bin\10.0.14393.0\x64").CombineWithFilePath("signtool.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\8.1\bin\x64").CombineWithFilePath("signtool.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\8.0\bin\x64").CombineWithFilePath("signtool.exe")); files.Add(programFilesPath.Combine(@"Microsoft SDKs\Windows\v7.1A\Bin").CombineWithFilePath("signtool.exe")); } else { // 32-bit specific paths. files.Add(programFilesPath.Combine(@"Windows Kits\10\bin\x86").CombineWithFilePath("signtool.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\10\bin\10.0.15063.0\x86").CombineWithFilePath("signtool.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\10\bin\10.0.14393.0\x86").CombineWithFilePath("signtool.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\8.1\bin\x86").CombineWithFilePath("signtool.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\8.0\bin\x86").CombineWithFilePath("signtool.exe")); files.Add(programFilesPath.Combine(@"Microsoft SDKs\Windows\v7.1A\Bin").CombineWithFilePath("signtool.exe")); } files.Add(programFilesPath.Combine(@"Windows Kits10\App Certification Kit").CombineWithFilePath("signtool.exe")); // Return the first path that exists. return(files.FirstOrDefault(file => _fileSystem.Exist(file))); }
/// <summary> /// Gets the alternative tool paths. /// </summary> /// <param name="settings">The settings.</param> /// <returns></returns> protected override IEnumerable <FilePath> GetAlternativeToolPaths(MsDeploySettings settings) { return(new FilePath[] { _Environment.GetSpecialPath(SpecialPath.ProgramFiles).CombineWithFilePath(_MsDeployFilePath), _Environment.GetSpecialPath(SpecialPath.ProgramFilesX86).CombineWithFilePath(_MsDeployFilePath) }); }
internal static DirectoryPath GetYearAndEditionRootPath(ICakeEnvironment environment, string year, string edition) { var programFiles = (year, edition) switch { ("2022", "BuildTools") => environment.GetSpecialPath(SpecialPath.ProgramFilesX86), ("2022", _) => environment.GetSpecialPath(SpecialPath.ProgramFiles), (_, _) => environment.GetSpecialPath(SpecialPath.ProgramFilesX86), };
/// <summary> /// Gets the path to sn.exe from disc. /// </summary> /// <returns>The path to sn.exe from disc.</returns> private FilePath GetFromDisc() { // Get the path to program files. var programFilesPath = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); // Get a list of the files we should check. var files = new List <FilePath>(); if (_environment.Is64BitOperativeSystem()) { // 64-bit specific paths. //NETFX4 files.Add(programFilesPath.Combine(@"Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\").CombineWithFilePath("sn.exe")); } else { // 32-bit specific paths. //NETFX4 files.Add(programFilesPath.Combine(@"Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\").CombineWithFilePath("sn.exe")); } // Return the first path that exist. return(files.FirstOrDefault(file => _fileSystem.Exist(file))); }
private static DirectoryPath GetFrameworkPath(ICakeEnvironment environment, PlatformTarget target, string version) { // Get the Microsoft .NET folder. var windowsFolder = environment.GetSpecialPath(SpecialPath.Windows); var netFolder = windowsFolder.Combine("Microsoft.NET"); if (target == PlatformTarget.MSIL) { // Get the framework folder. var is64Bit = environment.Is64BitOperativeSystem(); var frameWorkFolder = is64Bit ? netFolder.Combine("Framework64") : netFolder.Combine("Framework"); return(frameWorkFolder.Combine(version)); } if (target == PlatformTarget.x86) { return(netFolder.Combine("Framework").Combine(version)); } if (target == PlatformTarget.x64) { return(netFolder.Combine("Framework64").Combine(version)); } throw new NotSupportedException(); }
/// <summary> /// Gets the alternative tool paths to metrics.exe depending on the tool version. /// </summary> /// <param name="settings">The settings.</param> /// <returns>The alternative tool paths to metrics.exe.</returns> protected override IEnumerable <FilePath> GetAlternativeToolPaths(VsMetricsSettings settings) { if (_environment.Platform.IsUnix()) { return(Enumerable.Empty <FilePath>()); } var programFiles = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); var metrics2013 = programFiles.Combine("Microsoft Visual Studio 12.0/Team Tools/Static Analysis Tools/FxCop").CombineWithFilePath("metrics.exe"); var metrics2015 = programFiles.Combine("Microsoft Visual Studio 14.0/Team Tools/Static Analysis Tools/FxCop").CombineWithFilePath("metrics.exe"); if (settings.ToolVersion == VsMetricsToolVersion.Default) { return(new FilePath[] { metrics2015, metrics2013 }); } else if (settings.ToolVersion == VsMetricsToolVersion.VS2013) { return(new FilePath[] { metrics2013 }); } else if (settings.ToolVersion == VsMetricsToolVersion.VS2015) { return(new FilePath[] { metrics2015 }); } return(Enumerable.Empty <FilePath>()); }
private FilePath GetToolPath(string version) { var programFiles = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); var root = programFiles.Combine(string.Concat("Microsoft Visual Studio ", version, "/Common7/IDE/CommonExtensions/Microsoft/TestWindow")); return(root.CombineWithFilePath("vstest.console.exe")); }
private static DirectoryPath GetVisualStudio2019Path(IFileSystem fileSystem, ICakeEnvironment environment, MSBuildPlatform buildPlatform) { var vsEditions = new[] { "Enterprise", "Professional", "Community", "BuildTools" }; var visualStudio2019Path = environment.GetSpecialPath(SpecialPath.ProgramFilesX86); foreach (var edition in vsEditions) { // Get the bin path. var binPath = visualStudio2019Path.Combine(string.Concat("Microsoft Visual Studio/2019/", edition, "/MSBuild/Current/Bin")); // Change from Current to 16.0 after stable version released 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(visualStudio2019Path.Combine("Microsoft Visual Studio/2019/Professional/MSBuild/16.0/Bin")); }
/// <summary> /// Gets the path to sn.exe from disc. /// </summary> /// <returns>The path to sn.exe from disc.</returns> private FilePath GetFromDisc() { // Get the path to program files. var programFilesPath = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); var possibleVersions = new[] { "v10.0A", "v8.1A", "v8.1", "v8.0", "v7.0A" }; // Get a list of the files we should check. var files = new List <FilePath>(); if (_environment.Platform.Is64Bit) { // 64-bit specific paths. foreach (var version in possibleVersions) { //NETFX4 files.Add(programFilesPath.Combine(string.Format(@"Microsoft SDKs\Windows\{0}\Bin\NETFX 4.0 Tools\x64\", version)).CombineWithFilePath("sn.exe")); files.Add(programFilesPath.Combine(string.Format(@"Microsoft SDKs\Windows\{0}\Bin\x64\", version)).CombineWithFilePath("sn.exe")); } } else { // 32-bit specific paths. foreach (var version in possibleVersions) { //NETFX4 files.Add(programFilesPath.Combine(string.Format(@"Microsoft SDKs\Windows\{0}\Bin\NETFX 4.0 Tools\", version)).CombineWithFilePath("sn.exe")); files.Add(programFilesPath.Combine(string.Format(@"Microsoft SDKs\Windows\{0}\Bin\", version)).CombineWithFilePath("sn.exe")); } } // Return the first path that exist. return(files.FirstOrDefault(file => _fileSystem.Exist(file))); }
private static DirectoryPath GetFrameworkPath(ICakeEnvironment environment, MSBuildPlatform buildPlatform, string version) { // Get the Microsoft .NET folder. var windowsFolder = environment.GetSpecialPath(SpecialPath.Windows); var netFolder = windowsFolder.Combine("Microsoft.NET"); if (buildPlatform == MSBuildPlatform.Automatic) { // Get the framework folder. var is64Bit = environment.Platform.Is64Bit; var frameWorkFolder = is64Bit ? netFolder.Combine("Framework64") : netFolder.Combine("Framework"); return(frameWorkFolder.Combine(version)); } if (buildPlatform == MSBuildPlatform.x86) { return(netFolder.Combine("Framework").Combine(version)); } if (buildPlatform == MSBuildPlatform.x64) { return(netFolder.Combine("Framework64").Combine(version)); } throw new NotSupportedException(); }
private static DirectoryPath GetVisualStudio2022Path(IFileSystem fileSystem, ICakeEnvironment environment, MSBuildPlatform buildPlatform) { var vsEditions = new[] { "Enterprise", "Professional", "Community", "BuildTools", }; var visualStudio2022Paths = new[] { environment.GetSpecialPath(SpecialPath.ProgramFiles), environment.GetSpecialPath(SpecialPath.ProgramFilesX86), }; foreach (var visualStudio2022Path in visualStudio2022Paths) { foreach (var edition in vsEditions) { // Get the bin path. var binPath = visualStudio2022Path.Combine(string.Concat("Microsoft Visual Studio/2022/", edition, "/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(visualStudio2022Paths[0].Combine("Microsoft Visual Studio/2022/Professional/MSBuild/Current/Bin")); }
/// <summary> /// Gets the alternative tool paths to CMake. /// </summary> /// <param name="settings">The settings.</param> /// <returns>The alternative tool paths to CMake.</returns> protected override IEnumerable <FilePath> GetAlternativeToolPaths(CMakeSettings settings) { if (!_environment.Platform.IsUnix()) { var programFiles = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); var cmakePath = programFiles.Combine("cmake/bin").CombineWithFilePath("cmake.exe"); return(new[] { cmakePath }); } return(new FilePath[] { }); }
private static DirectoryPath GetMonoPathWindows() { var programFiles = _environment.Platform.Is64Bit ? SpecialPath.ProgramFilesX86 : SpecialPath.ProgramFiles; var programFilesPath = _environment.GetSpecialPath(programFiles); var monoPath = programFilesPath.Combine("Mono").Combine("bin").MakeAbsolute(_environment); return(_fileSystem.GetDirectory(monoPath).Exists ? monoPath : null); }
/// <summary> /// Resolves the path to the dotfuscaotr tool (dotfuscaotr.exe) /// </summary> /// <returns>The path to dotfuscaotr.exe</returns> public FilePath GetToolPath() { if (_exePath != null) { return(_exePath); } // Get the path to program files. var programFilesPath = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); _exePath = programFilesPath.Combine(@"PreEmptive Solutions\Dotfuscator Professional Edition 4.9").CombineWithFilePath("dotfuscator.exe"); if (_fileSystem.Exist(_exePath)) { return(_exePath); } else { throw new CakeException("Failed to find dotfuscator.exe."); } }
/// <summary> /// Gets alternative file paths which the tool may exist in /// </summary> /// <param name="settings">The settings.</param> /// <returns>The default tool path.</returns> protected override IEnumerable <FilePath> GetAlternativeToolPaths(TSettings settings) { /* * According to https://blogs.msdn.microsoft.com/heaths/2017/04/21/vswhere-is-now-installed-with-visual-studio-2017/, * Starting in the latest preview release of Visual Studio version 15.2 (26418.1-Preview), you can now find vswhere installed in * “%ProgramFiles(x86)%\Microsoft Visual Studio\Installer” (on 32-bit operating systems before Windows 10, you should use * “%ProgramFiles%\Microsoft Visual Studio\Installer”). */ return(new FilePath[] { _environment.GetSpecialPath(_environment.Platform.Is64Bit ? SpecialPath.ProgramFilesX86 : SpecialPath.ProgramFiles).CombineWithFilePath("Microsoft Visual Studio/Installer/" + VSWhereExecutableName), }); }
/// <summary> /// Get default paths for common docker client installations. /// </summary> /// <param name="fileSystem"></param> /// <param name="environment"></param> /// <returns></returns> private static DirectoryPath[] GetDefaultWindowsPaths(IFileSystem fileSystem, ICakeEnvironment environment) { var paths = new List <DirectoryPath>(); var programFiles = environment.GetSpecialPath(SpecialPath.ProgramFiles); var defaultDockerToolboxPath = programFiles.Combine("Docker Toolbox"); if (fileSystem.GetDirectory(defaultDockerToolboxPath).Exists) { paths.Add(defaultDockerToolboxPath); } return(paths.ToArray()); }
private static DirectoryPath GetVisualStudioPath(ICakeEnvironment environment, PlatformTarget target) { // Get the bin path. var programFilesPath = environment.GetSpecialPath(SpecialPath.ProgramFilesX86); var binPath = programFilesPath.Combine("MSBuild/12.0/Bin"); if (target == PlatformTarget.MSIL) { if (environment.Is64BitOperativeSystem()) { binPath = binPath.Combine("amd64"); } } if (target == PlatformTarget.x64) { binPath = binPath.Combine("amd64"); } return binPath; }
private static DirectoryPath GetVisualStudioPath(ICakeEnvironment environment, MSBuildPlatform buildPlatform, string version) { // Get the bin path. var programFilesPath = environment.GetSpecialPath(SpecialPath.ProgramFilesX86); var binPath = programFilesPath.Combine(string.Concat("MSBuild/", version, "/Bin")); if (buildPlatform == MSBuildPlatform.Automatic) { if (environment.Platform.Is64Bit) { binPath = binPath.Combine("amd64"); } } if (buildPlatform == MSBuildPlatform.x64) { binPath = binPath.Combine("amd64"); } return(binPath); }
private FilePath GetFromDisc() { var programFilesPath = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); var files = new List <FilePath>(); if (_environment.Platform.Is64Bit) { files.Add(programFilesPath.Combine(@"Windows Kits\10\bin\x64").CombineWithFilePath("makeappx.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\8.1\bin\x64").CombineWithFilePath("makeappx.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\8.0\bin\x64").CombineWithFilePath("makeappx.exe")); } else { files.Add(programFilesPath.Combine(@"Windows Kits\10\bin\x86").CombineWithFilePath("makeappx.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\8.1\bin\x86").CombineWithFilePath("makeappx.exe")); files.Add(programFilesPath.Combine(@"Windows Kits\8.0\bin\x86").CombineWithFilePath("makeappx.exe")); } return(files.FirstOrDefault(file => _fileSystem.Exist(file))); }
protected override IEnumerable <FilePath> GetAlternativeToolPaths(KnifeSettings settings) { var toolPaths = new List <FilePath>(base.GetAlternativeToolPaths(settings)); var chefdkInstalled = false; const string defaultPathWin = @"C:\opscode\chefdk\bin"; const string defaultPathNix = "/usr/bin"; //Look for chefdk installed on the system var defaultPath = _environment.Platform.IsUnix() ? _fileSystem.GetDirectory(defaultPathNix) : _fileSystem.GetDirectory(defaultPathWin); var knifeExec = _environment.Platform.IsUnix() ? _fileSystem.GetFile(_executableNames.Single(x => !x.EndsWith(".bat"))) : _fileSystem.GetFile(_executableNames.Single(x => x.EndsWith(".bat"))); var knifePath = defaultPath.Path.CombineWithFilePath(knifeExec.Path); if (_fileSystem.Exist(knifePath)) { chefdkInstalled = true; } if (!String.IsNullOrWhiteSpace(_environment.GetEnvironmentVariable("CHEF_DK_INSTALL_PATH"))) { knifePath = _environment.GetEnvironmentVariable("CHEF_DK_INSTALL_PATH"); if (_fileSystem.Exist(knifePath)) { chefdkInstalled = true; } } if (chefdkInstalled) { toolPaths.Add(knifePath); return(toolPaths); } if (_environment.Platform.Family != PlatformFamily.Windows) { throw new NotImplementedException("Knife executable not found--automatic install of chef dk is currently only supported on windows."); } //Install chefdk on the system if it isn't found var installerFileName = $"chefdk-{settings.ChefDKVersion}-1-x86.msi"; var packageUri = $"https://packages.chef.io/stable/windows/2012r2/{installerFileName}"; byte[] installerBytes = null; using (var httpClient = new HttpClient()) { installerBytes = httpClient.GetByteArrayAsync(packageUri).Result; } var installerPath = _fileSystem .GetFile(_environment.GetSpecialPath(SpecialPath.LocalTemp) .GetFilePath(installerFileName)); installerPath .OpenWrite() .Write(installerBytes, 0, installerBytes.Length); _processRunner .Start(installerPath.Path, new ProcessSettings { Arguments = new ProcessArgumentBuilder().Append("/qn /quiet /norestart") }) .WaitForExit(); toolPaths.Add(knifePath); return(toolPaths); }
protected override FilePath GetDefaultToolPath(IUnityPlatform settings) { var programFilesPath = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); return(programFilesPath.CombineWithFilePath("Unity/Editor/Unity.exe")); }
protected override IEnumerable <FilePath> GetAlternativeToolPaths(UnityPlatform settings) { var programFilesPath = _environment.GetSpecialPath(SpecialPath.ProgramFilesX86); yield return(programFilesPath.CombineWithFilePath("Unity/Editor/Unity.exe")); }