예제 #1
0
        /// <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(VSTestSettings settings)
        {
            var vsRootRelativeToolPath = FilePath.FromString($"Common7/IDE/CommonExtensions/Microsoft/TestWindow/{VSTestConsoleExecutableName}");

            foreach (var year in VisualStudio.Versions.TwentySeventeenAndLater)
            {
                foreach (var edition in settings.AllowPreviewVersion
                             ? VisualStudio.Editions.All
                             : VisualStudio.Editions.Stable)
                {
                    var path = VisualStudio.GetYearAndEditionToolPath(_environment, year, edition, vsRootRelativeToolPath);
                    if (_fileSystem.Exist(path))
                    {
                        yield return(path);
                    }
                }
            }

            foreach (var version in VisualStudio.Versions.TenToFourteen)
            {
                var path = VisualStudio.GetVersionNumberToolPath(_environment, version, vsRootRelativeToolPath);
                if (_fileSystem.Exist(path))
                {
                    yield return(path);
                }
            }
        }
예제 #2
0
        /// <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(MSTestSettings settings)
        {
            var vsRootRelativeToolPath = FilePath.FromString("Common7/IDE/mstest.exe");

            foreach (var year in VisualStudio.Versions.TwentySeventeenAndLater)
            {
                foreach (var edition in settings.AllowPreviewVersion
                             ? VisualStudio.Editions.All
                             : VisualStudio.Editions.Stable)
                {
                    var path = VisualStudio.GetYearAndEditionToolPath(_environment, year, edition, vsRootRelativeToolPath);
                    if (_fileSystem.Exist(path))
                    {
                        yield return(path);
                    }
                }
            }

            foreach (var version in VisualStudio.Versions.TenToFourteen)
            {
                var path = VisualStudio.GetVersionNumberToolPath(_environment, version, vsRootRelativeToolPath);
                if (_fileSystem.Exist(path))
                {
                    yield return(path);
                }
            }

            foreach (var environmentVariable in new[] { "VS140COMNTOOLS", "VS130COMNTOOLS", "VS120COMNTOOLS", "VS110COMNTOOLS", "VS100COMNTOOLS" })
            {
                var path = GetCommonToolPath(environmentVariable);
                if (path != null && _fileSystem.Exist(path))
                {
                    yield return(path);
                }
            }
        }