private void SaveModifiedFiles(IVsProject project)
        {
            // save all the open files in the project...
            foreach (var itemPath in project.GetProjectItems())
            {
                if (string.IsNullOrEmpty(itemPath))
                {
                    continue;
                }

                var solution = (IVsSolution)this.serviceProvider.GetService(typeof(SVsSolution));
                ErrorHandler.ThrowOnFailure(
                    solution.SaveSolutionElement((uint)__VSSLNSAVEOPTIONS.SLNSAVEOPT_SaveIfDirty, (IVsHierarchy)project, /* save entire project */ 0));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets the file paths of items in the project.
        /// </summary>
        public static IEnumerable <string> GetProjectItemPaths(this IVsProject project)
        {
            ErrorHandler.ThrowOnFailure(project.GetMkDocument(VSConstants.VSITEMID_ROOT, out var path));
            if (string.IsNullOrEmpty(path))
            {
                yield break;
            }

            yield return(path);

            foreach (var filePath in project.GetProjectItems())
            {
                if (!string.IsNullOrEmpty(filePath))
                {
                    yield return(filePath);
                }
            }
        }
Beispiel #3
0
 private void SaveModifiedFiles(IVsProject project)
 {
     // save all the open files in the project...
     foreach (var itemPath in project.GetProjectItems())
     {
         if (String.IsNullOrEmpty(itemPath))
         {
             continue;
         }
         var solution = (IVsSolution)_serviceProvider.GetService(typeof(SVsSolution));
         ErrorHandler.ThrowOnFailure(
             solution.SaveSolutionElement(
                 0,
                 (IVsHierarchy)project,
                 0
                 )
             );
     }
 }
 private void SaveModifiedFiles(IVsProject project) {
     // save all the open files in the project...
     foreach (var itemPath in project.GetProjectItems()) {
         if (String.IsNullOrEmpty(itemPath)) {
             continue;
         }
         var solution = (IVsSolution)_serviceProvider.GetService(typeof(SVsSolution));
         ErrorHandler.ThrowOnFailure(
             solution.SaveSolutionElement(
                 0,
                 (IVsHierarchy)project,
                 0
             )
         );
     }
 }
Beispiel #5
0
 private IEnumerable <string> FilteredTestOrSettingsFiles(IVsProject project)
 {
     return(project.GetProjectItems()
            .Where(s => IsTestFile(s) || IsSettingsFile(s)));
 }
Beispiel #6
0
 private IEnumerable <string> FindTestFiles(IVsProject project)
 {
     return(project.GetProjectItems().Where(f => File.Exists(f)));
 }
        public IEnumerable<TestContainerSource> FindSources(IVsProject project)
        {
            var containers = project.GetProjectItems()
                .Where(f => TestAdapterInfo.IsTestContainer(f) && File.Exists(f))
                .Select(f => new { Path = f, Directory = Path.GetDirectoryName(f), Priority = TestAdapterInfo.GetContainerPriority(f) })
                .ToList();

            return from c in containers
                   where !containers.Any(d => PathUtils.PathsEqual(c.Directory, d.Directory) && d.Priority > c.Priority)
                   select CreateTestContainerSource(project, c.Path);
        }