public static IEnumerable <string> AllItemsInProject(IVsProject project) { if (project == null) { throw new ArgumentNullException("project"); } string sProjectFilename; project.GetMkDocument(VSConstants.VSITEMID_ROOT, out sProjectFilename); string projectDir = Path.GetDirectoryName(sProjectFilename); IVsHierarchy hierarchy = project as IVsHierarchy; return (ChildrenOf(hierarchy, VSConstants.VSITEMID.Root) .Select( id => { string name = null; project.GetMkDocument((uint)id, out name); if (name != null && name.Length > 0 && !Path.IsPathRooted(name)) { name = AbsolutePathFromRelative(name, projectDir); } return name; }) .Where(File.Exists)); }
/// <summary> /// Searches for a file to transform based on a transformation file. /// Starts the search with the parent of the file then checks all visible children. /// </summary> /// <param name="hierarchy">Current project hierarchy</param> /// <param name="parentId">Parent ID of the file.</param> /// <param name="transformName">Name of the transformation file</param> /// <param name="docId">ID of the file to transform</param> /// <param name="documentPath">Resulting path of the file to transform</param> /// <returns>True if the correct file was found</returns> private bool TryGetFileToTransform(IVsHierarchy hierarchy, uint parentId, string transformName, out uint docId, out string documentPath) { IVsProject project = (IVsProject)hierarchy; IEnumerable <string> configs = ProjectUtilities.GetProjectConfigurations(hierarchy); if (ErrorHandler.Failed(project.GetMkDocument(parentId, out documentPath))) { docId = 0; return(false); } if (PackageUtilities.IsFileTransform(Path.GetFileName(documentPath), transformName, configs)) { docId = parentId; return(true); } else { object childIdObj; hierarchy.GetProperty(parentId, (int)__VSHPROPID.VSHPROPID_FirstVisibleChild, out childIdObj); docId = (uint)(int)childIdObj; if (ErrorHandler.Failed(project.GetMkDocument(docId, out documentPath))) { docId = 0; documentPath = null; return(false); } if (PackageUtilities.IsFileTransform(Path.GetFileName(documentPath), transformName, configs)) { return(true); } else { while (docId != VSConstants.VSITEMID_NIL) { hierarchy.GetProperty(docId, (int)__VSHPROPID.VSHPROPID_NextVisibleSibling, out childIdObj); docId = (uint)(int)childIdObj; if (ErrorHandler.Succeeded(project.GetMkDocument(docId, out documentPath))) { if (PackageUtilities.IsFileTransform(Path.GetFileName(documentPath), transformName, configs)) { return(true); } } } } } docId = 0; documentPath = null; return(false); }
private static BitmapSource GetSystemIconImage(HierarchyItemIdentity item) { IVsProject project = item.NestedHierarchy as IVsProject; if (project != null) { string document; if (ErrorHandler.Succeeded(project.GetMkDocument(item.NestedItemID, out document))) { SHFILEINFO shfi = new SHFILEINFO(); uint cbFileInfo = (uint)Marshal.SizeOf(shfi); IntPtr systemImageList = NativeMethods.SHGetFileInfo(document, 0, ref shfi, cbFileInfo, SHGFI.SysIconIndex | SHGFI.SmallIcon); if (systemImageList == IntPtr.Zero) { systemImageList = NativeMethods.SHGetFileInfo(document, 0, ref shfi, cbFileInfo, SHGFI.SysIconIndex | SHGFI.SmallIcon | SHGFI.UseFileAttributes); } if (systemImageList != IntPtr.Zero) { NativeImageList imageList = new NativeImageList(systemImageList); return(imageList.GetImage(shfi.iIcon)); } } } return(null); }
static public string FileName(this IVsProject project) { string projectFullPath = null; project.GetMkDocument(VSConstants.VSITEMID_ROOT, out projectFullPath); return(projectFullPath); }
public static string GetProjectPath(IVsProject project) { string projectPath; project.GetMkDocument(VSConstants.VSITEMID_ROOT, out projectPath); return(projectPath); }
public static string GetProjectBaseDirectory(IVsProject project) { string fullPath; ErrorHandler.ThrowOnFailure(project.GetMkDocument(VSConstants.VSITEMID_ROOT, out fullPath)); return(Path.GetFullPath(Path.GetDirectoryName(fullPath))); }
/// <summary> /// Enumerates all items in the project except those in the "Reference" group. /// </summary> /// <param name="project">The project from which to retrieve the items.</param> /// <returns>A list of item "Include" values. For items that specify files, these will be the file names.</returns> /// <exception cref="System.ArgumentNullException">Thrown if <c>project</c> is null.</exception> public ICollection <string> AllItemsInProject(IVsProject project) { if (project == null) { throw new ArgumentNullException("project"); } string projectDir = Path.GetDirectoryName(ProjectUtilities.GetProjectFilePath(project)); IVsHierarchy hierarchy = project as IVsHierarchy; List <string> allNames = ChildrenOf(hierarchy, HierarchyConstants.VSITEMID_ROOT).ConvertAll <string>( delegate(uint id) { string name = null; project.GetMkDocument(id, out name); if (name != null && name.Length > 0 && !Path.IsPathRooted(name)) { name = Utilities.AbsolutePathFromRelative(name, projectDir); } return(name); }); allNames.RemoveAll( delegate(string name) { return(!File.Exists(name)); }); return(allNames); }
/// <summary> /// Verifies if an item supports transforms. /// </summary> /// <param name="project">Current IVsProject</param> /// <param name="itemid">Id of the item inside the project</param> /// <returns>True if the item supports transforms</returns> private bool ItemSupportsTransforms(IVsProject project, uint itemid) { string itemFullPath; if (ErrorHandler.Failed(project.GetMkDocument(itemid, out itemFullPath))) { return(false); } bool itemSupportsTransforms = false; FileInfo transformFileInfo = new FileInfo(itemFullPath); // make sure its not a transform file itself bool isWebConfig = string.Compare("web.config", transformFileInfo.Name, StringComparison.OrdinalIgnoreCase) == 0; bool isTransformFile = this.IsItemTransformItem(project, itemid); bool isExtensionSupportedForFile = PackageUtilities.IsExtensionSupportedForFile(itemFullPath); bool isXmlFile = PackageUtilities.IsXmlFile(itemFullPath); if (!isWebConfig && !isTransformFile && isExtensionSupportedForFile && isXmlFile) { itemSupportsTransforms = true; } return(itemSupportsTransforms); }
private static string GetProjectFilePath(IVsProject project) { string path; project.GetMkDocument((uint)VSConstants.VSITEMID.Root, out path); return(path); }
public static string FileName(this IVsProject project) { string pbstrMkDocument = (string)null; project.GetMkDocument(4294967294U, out pbstrMkDocument); return(pbstrMkDocument); }
/// <summary> /// Gets the name of the project. /// </summary> /// <param name="project">IVsProject</param> /// <returns>project name</returns> public static string GetProjectName(this IVsProject project) { string projectName; project.GetMkDocument((uint)Microsoft.VisualStudio.VSConstants.VSITEMID.Root, out projectName); return(projectName); }
/// <summary> /// Verifies if an item supports transforms. /// </summary> /// <param name="project">Current IVsProject</param> /// <param name="itemid">Id of the item inside the project</param> /// <returns>True if the item supports transforms</returns> private bool ItemSupportsTransforms(IVsProject project, uint itemid) { if (ErrorHandler.Failed(project.GetMkDocument(itemid, out string itemFullPath))) { return(false); } if (!PackageUtilities.IsExtensionSupportedForFile(itemFullPath)) { return(false); } if (!this.package.IsItemTransformItem(project, itemid)) { return(false); } // web.config has its own transform support if (string.Compare("web.config", Path.GetFileName(itemFullPath), StringComparison.OrdinalIgnoreCase) == 0) { return(false); } // All quick checks done, ask if this is any transformer supports this. // This may hit the disk, which is costly for a context menu check and preferably avoided. return(TransformerFactory.IsSupportedFile(itemFullPath)); }
/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> private void OnPreviewTransformCommand(object sender, EventArgs e) { IVsHierarchy hierarchy = null; uint itemId = VSConstants.VSITEMID_NIL; // verify only one item is selected if (!IsSingleProjectItemSelection(out hierarchy, out itemId)) { return; } // make sure that the SlowCheetah project support has been added IVsProject project = (IVsProject)hierarchy; if (!ProjectSupportsTransforms(project)) { // TODO: should add a dialog here telling the user that the preview failed because the targets are not yet installed return; } // get the full path of the configuration xdt string transformPath = null; if (ErrorHandler.Failed(project.GetMkDocument(itemId, out transformPath))) { return; } object value; ErrorHandler.ThrowOnFailure(hierarchy.GetProperty(itemId, (int)__VSHPROPID.VSHPROPID_Parent, out value)); uint parentId = (uint)(int)value; if (parentId == (uint)VSConstants.VSITEMID.Nil) { return; } string documentPath; if (ErrorHandler.Failed(project.GetMkDocument(parentId, out documentPath))) { return; } PreviewTransform(hierarchy, documentPath, transformPath); }
private static string GetItemFileName(IVsProject project, uint itemId) { string fileName; project.GetMkDocument(itemId, out fileName); return(fileName); }
public static string GetProjectFilePath(IVsProject project) { string path = string.Empty; int hr = project.GetMkDocument(HierarchyConstants.VSITEMID_ROOT, out path); System.Diagnostics.Debug.Assert(hr == VSConstants.S_OK || hr == VSConstants.E_NOTIMPL, "GetMkDocument failed for project."); return path; }
public static string GetProjectFilePath(IVsProject project) { string path = string.Empty; int hr = project.GetMkDocument((uint)VSConstants.VSITEMID.Root, out path); Debug.Assert(hr == VSConstants.S_OK || hr == VSConstants.E_NOTIMPL, "GetMkDocument failed for project."); return path; }
static public string GetProjectFilePath(IVsProject project) { string path = string.Empty; int hr = project.GetMkDocument(HierarchyConstants.VSITEMID_ROOT, out path); System.Diagnostics.Debug.Assert(hr == VSConstants.S_OK || hr == VSConstants.E_NOTIMPL, "GetMkDocument failed for project."); return(path); }
public IEnumerable <ITestContainer> GetTestContainers(IVsProject project) { if (!project.IsTestProject(Guids.NodejsBaseProjectFactory)) { if (EqtTrace.IsVerboseEnabled) { EqtTrace.Verbose("TestContainerDiscoverer: Ignoring project {0} as it is not a Node.js project.", project.GetProjectName()); } yield break; } string path; project.GetMkDocument(VSConstants.VSITEMID_ROOT, out path); if (_detectingChanges) { SaveModifiedFiles(project); } ProjectInfo projectInfo; if (!_knownProjects.TryGetValue(path, out projectInfo)) { // Don't return any containers for projects we don't know about. yield break; } projectInfo.HasRequestedContainers = true; var latestWrite = project.GetProjectItemPaths().Aggregate( _lastWrite, (latest, filePath) => { try { var ft = File.GetLastWriteTimeUtc(filePath); return((ft > latest) ? ft : latest); } catch (UnauthorizedAccessException) { } catch (ArgumentException) { } catch (IOException) { } return(latest); }); var architecture = Architecture.X86; // TODO: Read the architecture from the project yield return(new TestContainer(this, path, latestWrite, architecture)); }
string GetItemPath(IntPtr hirarchryPtr, uint temId) { IVsProject project = Marshal.GetUniqueObjectForIUnknown(hirarchryPtr) as IVsProject; string itemFullPath = null; project?.GetMkDocument(temId, out itemFullPath); return(itemFullPath); }
static public string GetProjectFilePath(IVsProject project) { string path = string.Empty; int hr = project.GetMkDocument((uint)VSConstants.VSITEMID.Root, out path); Debug.Assert(hr == VSConstants.S_OK || hr == VSConstants.E_NOTIMPL, "GetMkDocument failed for project."); return(path); }
string GetItemPath(IntPtr hirarchryPtr, uint temId) { #pragma warning disable VSTHRD010 // Invoke single-threaded types on Main thread IVsProject project = Marshal.GetUniqueObjectForIUnknown(hirarchryPtr) as IVsProject; string itemFullPath = null; project?.GetMkDocument(temId, out itemFullPath); #pragma warning restore VSTHRD010 // Invoke single-threaded types on Main thread return(itemFullPath); }
/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> /// <param name="sender">>The object that fired the event</param> /// <param name="e">Event arguments</param> private void OnPreviewTransformCommand(object sender, EventArgs e) { uint itemId = VSConstants.VSITEMID_NIL; // verify only one item is selected if (!ProjectUtilities.IsSingleProjectItemSelection(out IVsHierarchy hierarchy, out itemId)) { return; } // make sure that the SlowCheetah project support has been added IVsProject project = (IVsProject)hierarchy; if (!this.ProjectSupportsTransforms(project)) { // TODO: should add a dialog here telling the user that the preview failed because the targets are not yet installed return; } // get the full path of the configuration xdt if (ErrorHandler.Failed(project.GetMkDocument(itemId, out string transformPath))) { return; } // Checks the SlowCheetah NuGet package installation this.NuGetManager.CheckSlowCheetahInstallation(hierarchy); ErrorHandler.ThrowOnFailure(hierarchy.GetProperty(itemId, (int)__VSHPROPID.VSHPROPID_Parent, out object parentIdObj)); uint parentId = (uint)(int)parentIdObj; if (parentId == (uint)VSConstants.VSITEMID.Nil) { return; } if (!this.TryGetFileToTransform(hierarchy, parentId, Path.GetFileName(transformPath), out uint docId, out string documentPath)) { // TO DO: Possibly tell the user that the transform file was not found. return; } try { PackageUtilities.GetAutomationFromHierarchy <ProjectItem>(hierarchy, docId).Save(); PackageUtilities.GetAutomationFromHierarchy <ProjectItem>(hierarchy, itemId).Save(); } catch { // If the item is not open, an exception is thrown, // but that is not a problem as it is not dirty } this.PreviewTransform(hierarchy, documentPath, transformPath); }
/// <inheritdoc/> protected override void OnInvoke(object sender, EventArgs e) { uint itemId = VSConstants.VSITEMID_NIL; // Verify only one item is selected if (!ProjectUtilities.IsSingleProjectItemSelection(out IVsHierarchy hierarchy, out itemId)) { return; } // Make sure that the project supports transformations IVsProject project = (IVsProject)hierarchy; if (!this.ScPackage.ProjectSupportsTransforms(project)) { return; } // Get the full path of the selected file if (ErrorHandler.Failed(project.GetMkDocument(itemId, out string transformPath))) { return; } // Checks the SlowCheetah NuGet package installation this.ScPackage.JoinableTaskFactory.Run(() => this.NuGetManager.CheckSlowCheetahInstallation(hierarchy)); // Get the parent of the file to start searching for the source file ErrorHandler.ThrowOnFailure(hierarchy.GetProperty(itemId, (int)__VSHPROPID.VSHPROPID_Parent, out object parentIdObj)); uint parentId = (uint)(int)parentIdObj; if (parentId == (uint)VSConstants.VSITEMID.Nil) { return; } if (!this.TryGetFileToTransform(hierarchy, parentId, Path.GetFileName(transformPath), out uint docId, out string documentPath)) { throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, Resources.Resources.Error_FileToTransformNotFound, transformPath)); } try { // Save the source and transform files before previewing PackageUtilities.GetAutomationFromHierarchy <ProjectItem>(hierarchy, docId).Save(); PackageUtilities.GetAutomationFromHierarchy <ProjectItem>(hierarchy, itemId).Save(); } catch { // If the item is not open, an exception is thrown, // but that is not a problem as it is not dirty } this.PreviewTransform(hierarchy, documentPath, transformPath); }
public static string GetProjectFullPath(this IVsHierarchy hierarchy) { string projectFile = string.Empty; IVsProject proj = hierarchy as IVsProject; if (proj != null) { proj.GetMkDocument((uint)VSConstants.VSITEMID_ROOT, out projectFile); } return(projectFile); }
/// <summary> /// Gets the file name from item. /// </summary> /// <param name="project">The project.</param> /// <param name="itemid">The itemID.</param> /// <returns>Full name of the file of the item</returns> public static string GetFileNameFromItem(IVsProject project, uint itemid) { string itemFullPath; if (ErrorHandler.Failed(project.GetMkDocument(itemid, out itemFullPath))) { return(null); } return(itemFullPath); }
/// <summary> /// Projects the supports transforms. /// </summary> /// <param name="project">The project.</param> /// <returns> /// [True] if project suppors transformation, otherwise [False] /// </returns> public static bool ProjectSupportsTransforms(IVsProject project) { string projectFullPath; if (ErrorHandler.Failed(project.GetMkDocument(VSConstants.VSITEMID_ROOT, out projectFullPath))) { return(false); } return(TransformationProvider.IsProjectSupported(projectFullPath)); }
/// <summary> /// Completes the project manager initialization process /// </summary> protected override void OnAggregationComplete() { base.OnAggregationComplete(); string name; innerProject.GetMkDocument(VSConstants.VSITEMID_ROOT, out name); ProjectDir = name.Substring(0, name.LastIndexOf('\\')); projectProxy = new BuildProjectProxy(innerProject); itemList = new ItemList(this); hierarchy_event_cookie = AdviseHierarchyEvents(itemList); ErrorHandler.ThrowOnFailure(GlobalServices.documentTracker.AdviseTrackProjectDocumentsEvents(this, out document_tracker_cookie)); }
public static string GetFullPath(this IVsProject project) { ThreadHelper.ThrowIfNotOnUIThread(); int result = project.GetMkDocument(VSConstants.VSITEMID_ROOT, out string fullPath); if (ErrorHandler.Succeeded(result)) { return(fullPath); } return(string.Empty); }
public static string GetProjectFullPath(IVsProject project) { try { string fullPath; ErrorHandler.ThrowOnFailure(project.GetMkDocument(VSConstants.VSITEMID_ROOT, out fullPath)); return(Path.GetFullPath(fullPath)); } catch (NotImplementedException) { return(string.Empty); } }
/// <summary> /// get the file name of the selected item/document /// </summary> /// <param name="project"></param> /// <param name="item id"></param> /// <param name="filename"></param> /// <returns></returns> private bool GetItemFileName(IVsProject project, uint itemId, out string filename) { string bstrMKDocument; if (project.GetMkDocument(itemId, out bstrMKDocument) == VSConstants.S_OK && !string.IsNullOrEmpty(bstrMKDocument)) { filename = bstrMKDocument; return(true); } filename = null; return(false); }
/// <summary> /// Update the associated project and itemId if necessary. /// </summary> private void Validate() { if (dirty) { // get project interface if (project == null && projectName != null && projectName.Length > 0) { project = Common.GetProjectByName(projectName) as IVsProject; } if (project != null) { // get projectName from project IVsHierarchy projHier = project as IVsHierarchy; string projname = Common.GetProjectName(projHier); // project.GetMkDocument(VSConstants.VSITEMID_ROOT, out projname); if (projname != null && projname.Length > 0) { projectName = projname; } // get itemId if (itemId == Nil && filePath != null && filePath.Length > 0) { int found; uint item; VSDOCUMENTPRIORITY[] prs = { 0 }; project.IsDocumentInProject(filePath, out found, prs, out item); if (found != 0) { itemId = item; } } // get filePath from project if (itemId != Nil) { string name; project.GetMkDocument(itemId, out name); if (name != null && name.Length > 0) { filePath = System.IO.Path.GetFullPath(name); } } } } }
public string GetProjectFullPath() { ThreadHelper.ThrowIfNotOnUIThread(); string fullPath = null; IVsProject project = GetVsProject(); if (project != null) { project.GetMkDocument(VSConstants.VSITEMID_ROOT, out fullPath); } return(fullPath); }
/// <summary> /// Enumerates all items in the project except those in the "Reference" group. /// </summary> /// <param name="project">The project from which to retrieve the items.</param> /// <returns>A list of item "Include" values. For items that specify files, these will be the file names.</returns> /// <exception cref="System.ArgumentNullException">Thrown if <c>project</c> is null.</exception> public ICollection<string> AllItemsInProject(IVsProject project) { if (project == null) { throw new ArgumentNullException("project"); } string projectDir = Path.GetDirectoryName(ProjectUtilities.GetProjectFilePath(project)); IVsHierarchy hierarchy = project as IVsHierarchy; List<string> allNames = ChildrenOf(hierarchy, HierarchyConstants.VSITEMID_ROOT).ConvertAll<string>( delegate(uint id) { string name = null; project.GetMkDocument(id, out name); if (name != null && name.Length > 0 && !Path.IsPathRooted(name)) { name = AbsolutePathFromRelative(name, projectDir); } return name; }); allNames.RemoveAll( delegate(string name) { return !File.Exists(name); }); return allNames; }
private bool ItemSupportsTransforms(IVsProject project, uint itemid) { string itemFullPath = null; if (ErrorHandler.Failed(project.GetMkDocument(itemid, out itemFullPath))) { return false; } bool itemSupportsTransforms = false; // make sure its not a transform file itsle bool isTransformFile = IsItemTransformItem(project, itemid); if (!isTransformFile && IsExtensionSupportedForFile(itemFullPath) && IsXmlFile(itemFullPath)) { itemSupportsTransforms = true; } return itemSupportsTransforms; }
private bool ProjectSupportsTransforms(IVsProject project) { string projectFullPath = null; if (ErrorHandler.Failed(project.GetMkDocument(VSConstants.VSITEMID_ROOT, out projectFullPath))) { return false; } string projectExtension = Path.GetExtension(projectFullPath); foreach (string supportedExtension in SupportedProjectExtensions) { if (projectExtension.Equals(supportedExtension, StringComparison.InvariantCultureIgnoreCase)) { return true; } } return false; }
public static IEnumerable<string> AllItemsInProject(IVsProject project) { if (project == null) { throw new ArgumentNullException("project"); } string sProjectFilename; project.GetMkDocument(VSConstants.VSITEMID_ROOT, out sProjectFilename); string projectDir = Path.GetDirectoryName(sProjectFilename); IVsHierarchy hierarchy = project as IVsHierarchy; return ChildrenOf(hierarchy, VSConstants.VSITEMID.Root) .Select( id => { string name = null; project.GetMkDocument((uint)id, out name); if (name != null && name.Length > 0 && !Path.IsPathRooted(name)) { name = AbsolutePathFromRelative(name, projectDir); } return name; }) .Where(File.Exists); }
private bool ItemSupportsTransforms(IVsProject project, uint itemid) { string itemFullPath = null; if (ErrorHandler.Failed(project.GetMkDocument(itemid, out itemFullPath))) return false; // make sure its not a transform file itsle //bool isTransformFile = IsItemTransformItem(project, itemid); var transformFileInfo = new FileInfo(itemFullPath); bool isWebConfig = string.Compare("web.config", transformFileInfo.Name, StringComparison.OrdinalIgnoreCase) == 0; return (isWebConfig && IsXmlFile(itemFullPath)); }
private bool IsOurProject(IVsProject project) { string projectDoc; project.GetMkDocument((uint)VSConstants.VSITEMID.Root, out projectDoc); return projectDoc == Project.Url; }
public static string GetProjectPath(IVsProject project) { string projectPath; project.GetMkDocument(VSConstants.VSITEMID_ROOT, out projectPath); return projectPath; }
private static string GetItemFileName(IVsProject project, uint itemId) { string fileName; project.GetMkDocument(itemId, out fileName); return fileName; }
private bool ItemSupportsTransforms(IVsProject project, uint itemid) { string itemFullPath = null; if (ErrorHandler.Failed(project.GetMkDocument(itemid, out itemFullPath))) { return false; } bool itemSupportsTransforms = false; // make sure its not a transform file itsle bool isTransformFile = IsItemTransformItem(project, itemid); FileInfo transformFileInfo = new FileInfo(itemFullPath); bool isWebConfig = string.Compare("web.config", transformFileInfo.Name, StringComparison.OrdinalIgnoreCase) == 0; if (!isWebConfig && !isTransformFile && IsExtensionSupportedForFile(itemFullPath) && IsXmlFile(itemFullPath)) { itemSupportsTransforms = true; } return itemSupportsTransforms; }
public IEnumerable<ITestContainer> GetTestContainers(IVsProject project) { if (!project.IsTestProject(GuidList.guidPythonProjectGuid)) { if (EqtTrace.IsVerboseEnabled) { EqtTrace.Verbose("TestContainerDiscoverer: Ignoring project {0} as it is not a test project.", project.GetProjectName()); } yield break; } string path; project.GetMkDocument(VSConstants.VSITEMID_ROOT, out path); if (_detectingChanges) { SaveModifiedFiles(project); } ProjectInfo projectInfo; if (!_knownProjects.TryGetValue(path, out projectInfo)) { // Don't return any containers for projects we don't know about. yield break; } projectInfo.HasRequestedContainers = true; var latestWrite = project.GetProjectItemPaths().Aggregate( _lastWrite, (latest, filePath) => { try { var ft = File.GetLastWriteTimeUtc(filePath); return (ft > latest) ? ft : latest; } catch (UnauthorizedAccessException) { } catch (ArgumentException) { } catch (IOException) { } return latest; }); var architecture = Architecture.X86; // TODO: Read the architecture from the project yield return new TestContainer(this, path, latestWrite, architecture); }