void InstallDefaultSource(MachineWideInstallation mwInstl) { var msvsdirPath = new DirectoryInfo(@"C:\Program Files (x86)").EnumerateDirectories("Microsoft Visual Studio *"). Where(_ => Regex.IsMatch(_.Name, @"Microsoft Visual Studio \d+\.\d+")). OrderByDescending(_ => _.Name). Select(_ => _.FullName). First(); { var pkgName = "TestWindow"; var src = Path.Combine(msvsdirPath, @"Common7\IDE\CommonExtensions\Microsoft\TestWindow"); mwInstl.OnPrigSourceInstalling(pkgName, src); var stdout = PrigExecutor.StartInstalling(pkgName, src); mwInstl.OnPrigSourceInstalled(stdout); } { var pkgName = "TestWindow1"; var src = Path.Combine(msvsdirPath, @"Common7\IDE\CommonExtensions\Microsoft\TestWindow\x64"); if (EnvironmentRepository.ExistsDirectory(src)) { mwInstl.OnPrigSourceInstalling(pkgName, src); var stdout = PrigExecutor.StartInstalling(pkgName, src); mwInstl.OnPrigSourceInstalled(stdout); } } }
void InstallDefaultSource(MachineWideInstallation mwInstl) { var query = from envVar in EnvironmentRepository.GetEnvironmentVariables() where Regex.IsMatch(envVar.Key, @"VS\d{3}COMNTOOLS", RegexOptions.IgnoreCase) select envVar; foreach (var envVar in query) { var vsComnToolsPathName = envVar.Key; var vsComnToolsPath = envVar.Value; var msvsdirPath = Path.Combine(vsComnToolsPath, @"..\.."); { var pkgName = "TestWindow_" + vsComnToolsPathName; var src = Path.Combine(msvsdirPath, @"Common7\IDE\CommonExtensions\Microsoft\TestWindow"); if (EnvironmentRepository.ExistsDirectory(src)) { mwInstl.OnPrigSourceInstalling(pkgName, src); var stdout = PrigExecutor.StartInstalling(pkgName, src); mwInstl.OnPrigSourceInstalled(stdout); } } { var pkgName = "TestWindow64_" + vsComnToolsPathName; var src = Path.Combine(msvsdirPath, @"Common7\IDE\CommonExtensions\Microsoft\TestWindow\x64"); if (EnvironmentRepository.ExistsDirectory(src)) { mwInstl.OnPrigSourceInstalling(pkgName, src); var stdout = PrigExecutor.StartInstalling(pkgName, src); mwInstl.OnPrigSourceInstalled(stdout); } } } }